- Prove a fix with a failing test first
- Fast gates, slow gates, and what blocks
- Keep agents honest with verifiers and evals
One command that says yes or no
A gate is an automated check every change must pass. Wrap your tests, build and lint in one command that exits non-zero on failure. Then the agent can check its own work.
Failing test first (TDD, FTW)
For a bug fix, the test comes before the fix. The failing test proves the bug exists, and the same test proves the fix works. Step through it.
Write a failing test
It reproduces the bug, and fails.
Commit the test
On its own, before any fix.
Fix without touching the test
The agent changes code only.
Gate green
Same test, now passing.
Fast gates and slow gates
Two gates, two jobs. Select a bar to see what it runs.
Fast gate, on every pull request
Slow gate, nightly
Select a bar
Many quick gates through the day, one long run at night.
Nightly red blocks everything
If the nightly run fails, nothing merges until it is fixed and closed with evidence. Turn the nightly red and see what happens.
The UI feedback loop
Tests do not see layout. For UI work the agent implements, takes a screenshot, compares it with the design, and adjusts. It usually takes 2 to 3 rounds.
The first attempt is close but off. Run a round.
A verifier with fresh eyes
The agent that wrote the code is the worst judge of it. A verifier subagent starts with a fresh context and checks the result against the spec.
The writer's context
Full of its own attempts and reasons.
The verifier's context
Only what it needs to judge.
An unbiased final check, defined once in .claude/agents/.
Continuous evals
An eval is a real task with a known good outcome. Keep 20 to 50 of them. Rerun them whenever your agent setup changes. Try a change.
30 eval tasks
Change something, then rerun:
Every change to the setup can quietly break a task that used to work.
A checker script beats a rule in prose
Rules that live only in prose get skipped. A small checker script reads the lead's state file and fails loudly.
Rule in prose
"Always give a reason for a free slot. Keep the usage reading fresh. Hand over before context fills."
Followed most of the time. Skipped when the session is long and busy.
Checker script
The lead runs it every sweep and before every report, and does not publish while it fails.
Adversarial review of a PR stack
Each pull request can pass its own gate and still break when merged with its neighbors. Before related PRs merge together, a reviewer agent tries to break the whole stack.
rows, which #42 renamed. Each PR passes alone. Together, the progress bar is always empty.AI review, with people in charge
- A
REVIEW.mdin the repo defines the passes: bugs and logic, security, match with spec and plan. - It says what is Important and what is a nit, and caps the nits.
- The agent that wrote the code cannot approve it.
- Findings inform your team's reviewers. They never approve or block alone.
Key takeaways
- Give every task one gate command that exits non-zero on failure.
- Failing test first, committed first, and the fix never edits the test.
- Fast gate on every PR, full suite nightly. A red nightly blocks all merges.
- Use screenshots for UI, a fresh-context verifier, and 20 to 50 evals rerun on every setup change.
- Enforce with scripts and hooks. Prose rules get skipped.