Skip to content

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
4.0 KB
Raw Blame

/qa for APIs, CLIs and background jobs (functional surface)

Use this workflow when the target is not a web page: an HTTP API, a command-line tool, a queue worker, a scheduled job, or a webhook receiver. You test it with the repository's own commands and clients. Never open a browser for these targets and never build a new test harness.

Step 1 — Define the target and boundaries

  1. Read the request, README, CLAUDE.md/TESTING.md, the relevant source entrypoints, and existing tests. Write down:
    • Target: the exact endpoint, command, job or webhook (e.g. POST /api/refunds, bin/export --since, SendDigestJob).
    • Contracts: what the docs, types or tests say it must do. Each contract gets an ID (C1, C2…).
    • Tools: the documented way to run it (curl against the dev server, bin/rails runner, npm run cli --, the queue's test helper).
  2. Isolation. Use local or fixture-owned state only: a test database, a temp directory, a fake queue, synthetic users. Check what localhost points at and where outgoing calls go before running anything; if a command could reach production or a third-party service, stop and ask the user for permission naming the target and the effect.
  3. Post the target, contracts, tools, and the data you are allowed to write as a short plan before running any command.

If a target or contract is ambiguous, ask before running commands. If a required service is missing, mark the affected contracts blocked and continue with the others.

Step 2 — Map contracts to probes

For each contract, pick the rows that apply and plan one probe per row:

Contract type What to check
Success Output and the final business effect (row written, file created, email queued), not just a 2xx or exit 0
Invalid / missing input The documented rejection and status/exit code; no state change
Auth Valid caller, missing/invalid credentials, wrong owner or role; no effect when rejected
CLI contract Exit code, stdout and stderr separately; files changed
State transitions Initial, intermediate and final states; only permitted transitions happen
Timeouts / cancellation Partial state after a timeout; owned work stops; recovery path works
Retries The documented attempt count and backoff; terminal state; no unbounded retry
Duplicates / idempotency Same request or event twice → the documented number of effects
Concurrency / ordering Two competing operations in both orders → final invariant holds

Output: the probe list in report.md: contract ID, setup, exact command, expected result.

Step 3 — Run probes

For each probe, in order:

  1. Reset to the planned initial state and record it.
  2. Run the exact command with a timeout (default 60s). Save exit code/status, stdout and stderr to evidence/NNN/ without masking failures.
  3. Inspect the final durable state (query the table, list the directory, read the queue).
  4. Compare with the expected result and record pass, fail, blocked (prerequisite missing), not run, or inconclusive.
  5. For a fail, re-run the exact same command from the same initial state once. Two failures = confirmed. One = "not reproduced"; record both runs.

Never paste secrets into commands or evidence; refer to them by environment variable name.

Step 4 — Report

Write report.md with:

  • Target, revision (git rev-parse HEAD), runtime versions, and the isolation used.
  • A contract table: ID, probe, expected, observed, outcome, evidence path.
  • Confirmed failures first, each with the exact replay command and observed output.
  • Blocked and not-run contracts with the reason.
  • Proposed regression tests: for each confirmed failure, the test file it belongs in (prefer extending an existing test) and the assertion that would fail today.
  • Cleanup: what you removed, and anything you could not remove.

There is no health score for functional targets. The verdict is pass only if every required contract passed; any fail, blocked or inconclusive required contract makes the run not passing, and the summary must say which.