Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA
TypeScript
Merge remote-tracking branch 'origin/main' into v0.3.6-qa-upgrades
Garry Tan3d750d89af3a
diff --cc qa/SKILL.mdindex 4f3b14fe0,b22def6f8..adc5e8565--- a/qa/SKILL.md+++ b/qa/SKILL.md@@@ -32,25 -45,29 +44,30 @@@ You are a QA engineer. Test web applica**Find the browse binary:**+ ## SETUP (run this check BEFORE any browse command)+```bash- BROWSE_OUTPUT=$(browse/bin/find-browse 2>/dev/null || ~/.claude/skills/gstack/browse/bin/find-browse 2>/dev/null)- B=$(echo "$BROWSE_OUTPUT" | head -1)- META=$(echo "$BROWSE_OUTPUT" | grep "^META:" || true)- if [ -z "$B" ]; then- echo "ERROR: browse binary not found"- exit 1+ _ROOT=$(git rev-parse --show-toplevel 2>/dev/null)+ B=""+ [ -n "$_ROOT" ] && [ -x "$_ROOT/.claude/skills/gstack/browse/dist/browse" ] && B="$_ROOT/.claude/skills/gstack/browse/dist/browse"+ [ -z "$B" ] && B=~/.claude/skills/gstack/browse/dist/browse+ if [ -x "$B" ]; then+ echo "READY: $B"+ else+ echo "NEEDS_SETUP"fi- echo "READY: $B"- [ -n "$META" ] && echo "$META"```- If you see `META:UPDATE_AVAILABLE`: tell the user an update is available, STOP and wait for approval, then run the command from the META payload and re-run the setup check.+ If `NEEDS_SETUP`:+ 1. Tell the user: "gstack browse needs a one-time build (~10 seconds). OK to proceed?" Then STOP and wait.+ 2. Run: `cd <SKILL_DIR> && ./setup`+ 3. If `bun` is not installed: `curl -fsSL https://bun.sh/install | bash`-**Create output directories:**+**Set up report directory (persistent, global):**```bash-REPORT_DIR=".gstack/qa-reports"+REMOTE_SLUG=$(browse/bin/remote-slug 2>/dev/null || ~/.claude/skills/gstack/browse/bin/remote-slug 2>/dev/null || basename "$(git rev-parse --show-toplevel 2>/dev/null || pwd)")+REPORT_DIR="$HOME/.gstack/projects/$REMOTE_SLUG/qa-reports"mkdir -p "$REPORT_DIR/screenshots"```diff --cc test/skill-e2e.test.tsindex aab4a7fa4,478b34159..0c66d79e8--- a/test/skill-e2e.test.ts+++ b/test/skill-e2e.test.ts@@@ -132,209 -72,97 +132,292 @@@ Report what each command returned.`expect(result.browseErrors).toHaveLength(0);expect(result.exitReason).toBe('success');}, 90_000);++++ test('agent discovers browse binary via SKILL.md setup block', async () => {- const ROOT = path.resolve(import.meta.dir, '..');+ const skillMd = fs.readFileSync(path.join(ROOT, 'SKILL.md'), 'utf-8');+ const setupStart = skillMd.indexOf('## SETUP');+ const setupEnd = skillMd.indexOf('## IMPORTANT');+ const setupBlock = skillMd.slice(setupStart, setupEnd);++ // Guard: verify we extracted a valid setup block+ expect(setupBlock).toContain('browse/dist/browse');++ const result = await runSkillTest({+ prompt: `Follow these instructions to find the browse binary and run a basic command.++ ${setupBlock}++ After finding the binary, run: $B goto ${testServer.url}+ Then run: $B text+ Report whether it worked.`,+ workingDirectory: tmpDir,+ maxTurns: 10,+ timeout: 60_000,+ });++ expect(result.browseErrors).toHaveLength(0);+ expect(result.exitReason).toBe('success');+ }, 90_000);++ test('SKILL.md setup block shows NEEDS_SETUP when binary missing', async () => {+ // Create a tmpdir with no browse binary+ const emptyDir = fs.mkdtempSync(path.join(os.tmpdir(), 'skill-e2e-empty-'));+- const ROOT = path.resolve(import.meta.dir, '..');+ const skillMd = fs.readFileSync(path.join(ROOT, 'SKILL.md'), 'utf-8');+ const setupStart = skillMd.indexOf('## SETUP');+ const setupEnd = skillMd.indexOf('## IMPORTANT');+ const setupBlock = skillMd.slice(setupStart, setupEnd);++ const result = await runSkillTest({+ prompt: `Follow these instructions exactly. Run the bash code block below and report what it outputs.++ ${setupBlock}++ Report the exact output. Do NOT try to fix or install anything — just report what you see.`,+ workingDirectory: emptyDir,+ maxTurns: 5,+ timeout: 30_000,+ });++ // Agent should see NEEDS_SETUP (not crash or guess wrong paths)- const allText = result.messages- .map((m: any) => JSON.stringify(m))- .join('\n');++ const allText = result.output || '';+ expect(allText).toContain('NEEDS_SETUP');++ // Clean up+ try { fs.rmSync(emptyDir, { recursive: true, force: true }); } catch {}+ }, 60_000);++ test('SKILL.md setup block works outside git repo', async () => {+ // Create a tmpdir outside any git repo+ const nonGitDir = fs.mkdtempSync(path.join(os.tmpdir(), 'skill-e2e-nogit-'));+- const ROOT = path.resolve(import.meta.dir, '..');+ const skillMd = fs.readFileSync(path.join(ROOT, 'SKILL.md'), 'utf-8');+ const setupStart = skillMd.indexOf('## SETUP');+ const setupEnd = skillMd.indexOf('## IMPORTANT');+ const setupBlock = skillMd.slice(setupStart, setupEnd);++ const result = await runSkillTest({+ prompt: `Follow these instructions exactly. Run the bash code block below and report what it outputs.++ ${setupBlock}++ Report the exact output — either "READY: <path>" or "NEEDS_SETUP".`,+ workingDirectory: nonGitDir,+ maxTurns: 5,+ timeout: 30_000,+ });++ // Should either find global binary (READY) or show NEEDS_SETUP — not crash- const allText = result.messages- .map((m: any) => JSON.stringify(m))- .join('\n');++ const allText = result.output || '';+ expect(allText).toMatch(/READY|NEEDS_SETUP/);++ // Clean up+ try { fs.rmSync(nonGitDir, { recursive: true, force: true }); } catch {}+ }, 60_000);+});++// --- B4: QA skill E2E ---++describeE2E('QA skill E2E', () => {+ let qaDir: string;++ beforeAll(() => {+ testServer = testServer || startTestServer();+ qaDir = fs.mkdtempSync(path.join(os.tmpdir(), 'skill-e2e-qa-'));+ setupBrowseShims(qaDir);++ // Copy qa skill files into tmpDir+ copyDirSync(path.join(ROOT, 'qa'), path.join(qaDir, 'qa'));++ // Create report directory+ fs.mkdirSync(path.join(qaDir, 'qa-reports'), { recursive: true });+ });++ afterAll(() => {+ testServer?.server?.stop();+ try { fs.rmSync(qaDir, { recursive: true, force: true }); } catch {}+ });++ test('/qa quick completes without browse errors', async () => {+ const result = await runSkillTest({+ prompt: `You have a browse binary at ${browseBin}. Assign it to B variable like: B="${browseBin}"++Read the file qa/SKILL.md for the QA workflow instructions.++Run a Quick-depth QA test on ${testServer.url}/basic.html+Do NOT use AskUserQuestion — run Quick tier directly.+Write your report to ${qaDir}/qa-reports/qa-report.md`,+ workingDirectory: qaDir,+ maxTurns: 30,+ timeout: 180_000,+ });++ logCost('/qa quick', result);+ expect(result.browseErrors).toHaveLength(0);+ expect(result.exitReason).toBe('success');+ }, 240_000);+});++// --- B5: Review skill E2E ---++describeE2E('Review skill E2E', () => {+ let reviewDir: string;++ beforeAll(() => {+ reviewDir = fs.mkdtempSync(path.join(os.tmpdir(), 'skill-e2e-review-'));++ // Pre-build a git repo with a vulnerable file on a feature branch (decision 5A)+ const { spawnSync } = require('child_process');+ const run = (cmd: string, args: string[]) =>+ spawnSync(cmd, args, { cwd: reviewDir, stdio: 'pipe', timeout: 5000 });++ run('git', ['init']);+ run('git', ['config', 'user.email', '[email protected]']);+ run('git', ['config', 'user.name', 'Test']);++ // Commit a clean base on main+ fs.writeFileSync(path.join(reviewDir, 'app.rb'), '# clean base\nclass App\nend\n');+ run('git', ['add', 'app.rb']);+ run('git', ['commit', '-m', 'initial commit']);++ // Create feature branch with vulnerable code+ run('git', ['checkout', '-b', 'feature/add-user-controller']);+ const vulnContent = fs.readFileSync(path.join(ROOT, 'test', 'fixtures', 'review-eval-vuln.rb'), 'utf-8');+ fs.writeFileSync(path.join(reviewDir, 'user_controller.rb'), vulnContent);+ run('git', ['add', 'user_controller.rb']);+ run('git', ['commit', '-m', 'add user controller']);++ // Copy review skill files+ fs.copyFileSync(path.join(ROOT, 'review', 'SKILL.md'), path.join(reviewDir, 'review-SKILL.md'));+ fs.copyFileSync(path.join(ROOT, 'review', 'checklist.md'), path.join(reviewDir, 'review-checklist.md'));+ fs.copyFileSync(path.join(ROOT, 'review', 'greptile-triage.md'), path.join(reviewDir, 'review-greptile-triage.md'));+ });++ afterAll(() => {+ try { fs.rmSync(reviewDir, { recursive: true, force: true }); } catch {}+ });++ test('/review produces findings on SQL injection branch', async () => {+ const result = await runSkillTest({+ prompt: `You are in a git repo on a feature branch with changes against main.+Read review-SKILL.md for the review workflow instructions.+Also read review-checklist.md and apply it.+Run /review on the current diff (git diff main...HEAD).+Write your review findings to ${reviewDir}/review-output.md`,+ workingDirectory: reviewDir,+ maxTurns: 15,+ timeout: 90_000,+ });++ logCost('/review', result);+ expect(result.exitReason).toBe('success');+ }, 120_000);+});++// --- B6/B7/B8: Planted-bug outcome evals ---++// Outcome evals also need ANTHROPIC_API_KEY for the LLM judge+const hasApiKey = !!process.env.ANTHROPIC_API_KEY;+const describeOutcome = (evalsEnabled && hasApiKey) ? describe : describe.skip;++describeOutcome('Planted-bug outcome evals', () => {+ let outcomeDir: string;++ beforeAll(() => {+ testServer = testServer || startTestServer();+ outcomeDir = fs.mkdtempSync(path.join(os.tmpdir(), 'skill-e2e-outcome-'));+ setupBrowseShims(outcomeDir);++ // Copy qa skill files+ copyDirSync(path.join(ROOT, 'qa'), path.join(outcomeDir, 'qa'));+ });++ afterAll(() => {+ testServer?.server?.stop();+ try { fs.rmSync(outcomeDir, { recursive: true, force: true }); } catch {}+ });++ /**+ * Shared planted-bug eval runner.+ * Runs /qa Standard on a fixture page, then scores with outcomeJudge.+ */+ async function runPlantedBugEval(fixture: string, groundTruthFile: string, label: string) {+ const reportDir = path.join(outcomeDir, `reports-${label}`);+ fs.mkdirSync(path.join(reportDir, 'screenshots'), { recursive: true });+ const reportPath = path.join(reportDir, 'qa-report.md');+- // Phase 1: Agent SDK runs /qa Standard++ // Phase 1: runs /qa Standard+ const result = await runSkillTest({+ prompt: `You have a browse binary at ${browseBin}. Assign it to B variable like: B="${browseBin}"++Read the file qa/SKILL.md for the QA workflow instructions.++Navigate to ${testServer.url}/${fixture} and run a Standard-depth QA test.+Do NOT use AskUserQuestion — run Standard tier directly.+Write your report to ${reportPath}+Save screenshots to ${reportDir}/screenshots/++Be thorough: check console, check all links, check all forms, check mobile viewport, check accessibility.`,+ workingDirectory: outcomeDir,+ maxTurns: 40,+ timeout: 300_000,+ });++ logCost(`/qa ${label}`, result);++ // Phase 1 assertions: browse mechanics+ expect(result.browseErrors).toHaveLength(0);+ expect(result.exitReason).toBe('success');++ // Phase 2: Outcome evaluation via LLM judge+ const groundTruth = JSON.parse(+ fs.readFileSync(path.join(ROOT, 'test', 'fixtures', groundTruthFile), 'utf-8'),+ );++ // Read the generated report (try the expected path, then glob for any .md in reportDir)+ let report: string;+ if (fs.existsSync(reportPath)) {+ report = fs.readFileSync(reportPath, 'utf-8');+ } else {+ // Agent may have named it differently — find any .md in reportDir+ const mdFiles = fs.readdirSync(reportDir).filter(f => f.endsWith('.md'));+ if (mdFiles.length === 0) {+ dumpOutcomeDiagnostic(outcomeDir, label, '(no report file found)', { error: 'missing report' });+ throw new Error(`No report file found in ${reportDir}`);+ }+ report = fs.readFileSync(path.join(reportDir, mdFiles[0]), 'utf-8');+ }++ const judgeResult = await outcomeJudge(groundTruth, report);+ console.log(`${label} outcome:`, JSON.stringify(judgeResult, null, 2));++ // Diagnostic dump on failure (decision 1C)+ if (judgeResult.detection_rate < groundTruth.minimum_detection || judgeResult.false_positives > groundTruth.max_false_positives) {+ dumpOutcomeDiagnostic(outcomeDir, label, report, judgeResult);+ }++ // Phase 2 assertions+ expect(judgeResult.detection_rate).toBeGreaterThanOrEqual(groundTruth.minimum_detection);+ expect(judgeResult.false_positives).toBeLessThanOrEqual(groundTruth.max_false_positives);+ expect(judgeResult.evidence_quality).toBeGreaterThanOrEqual(3);+ }++ // B6: Static dashboard — broken link, disabled submit, overflow, missing alt, console error+ test('/qa standard finds >= 3 of 5 planted bugs (static)', async () => {+ await runPlantedBugEval('qa-eval.html', 'qa-eval-ground-truth.json', 'b6-static');+ }, 360_000);++ // B7: SPA — broken route, stale state, async race, missing aria, console warning+ test('/qa standard finds >= 3 of 5 planted SPA bugs', async () => {+ await runPlantedBugEval('qa-eval-spa.html', 'qa-eval-spa-ground-truth.json', 'b7-spa');+ }, 360_000);++ // B8: Checkout — email regex, NaN total, CC overflow, missing required, stripe error+ test('/qa standard finds >= 3 of 5 planted checkout bugs', async () => {+ await runPlantedBugEval('qa-eval-checkout.html', 'qa-eval-checkout-ground-truth.json', 'b8-checkout');+ }, 360_000);- test.todo('/qa quick completes without browse errors');+ // Ship E2E deferred — too complex (requires full git + test suite + VERSION + CHANGELOG)test.todo('/ship completes without browse errors');- test.todo('/review completes without browse errors');});