Code review by an agent in Claude Code: what my reviewer catches, and what it misses
My reviewer is a Claude Code subagent that is read-only and receives the diff and the request, never the conversation that produced the code. It gives no score: it returns a list of blockers and should-fix items, each with a concrete failure scenario. Out of the 30 tasks logged in my ledger, 12 had at least one blocker at the first review, on code that had already passed lint, type checks and tests.
The problem: an agent reviewing itself finds itself convincing
Ask the agent that just wrote some code to review it. It finds every reason for its choices in its context, and it approves them. This is not bad faith: it reads with the same understanding, so with the same blind spots.
A green test suite says no more. It proves that the code does what the tests check, not that the tests check the right thing. That is exactly where the bugs that reach production hide.
The reviewer: a subagent that can only read
In Claude Code, a subagent is a Markdown file stored in .claude/agents/, in ~/.claude/agents/ for all your projects, or shipped in a plugin. Each one works in its own context window. Two header fields matter here: tools limits the tools it may use, model picks the model. Here is the header of mine, barely shortened:
---
name: reviewer
description: Read-only reviewer. Judges one diff against its brief with fresh context and returns a single JSON verdict.
tools: Read, Grep, Glob, Bash
model: opus
---With neither Edit nor Write in the list, it cannot change a file. Bash lets it read git diff and run a single test file when it doubts a claim; for that tool, the ban on editing, committing or running the whole suite is an instruction, not a barrier.
It receives the diff, the task brief, the check results and the project's CLAUDE.md. Nothing else. And it runs on a model at least as strong as the one that wrote the code: a model cannot find a bug it does not understand.
The rules I give it
- No score. An “8 out of 10” hides a blocker behind a good average and invites cosmetic edits to gain a point. The only exit condition: zero blockers.
- Two categories, everything reported. A blocker is a bug, a regression, a wrong number shown to the user, a data leak, a broken build or a test that cannot fail. A should-fix is a real cost in quality, performance or maintenance. Matters of taste are dropped.
- One failure scenario per finding: “with this input, this wrong result”. No scenario, no finding. The reviewer first lists everything that puzzles it, then keeps only what it can prove.
- Checks run before it. Lint, type checks and tests run before the review. There is no point paying a model to find what a command finds.
- Two fix rounds, no more. The second round only reviews what changed since the first. Beyond that, the chain stops and I take over.
The question I ask it to put first: does each new test bite? In other words, would a plausible but wrong implementation make it fail?
What it catches, with numbers
Every task that goes through my chain leaves a line in a ledger: blockers at the first review, number of rounds, findings. Across 30 tasks spread over three of my projects, between October 24 and November 9, 2026:
- 27 tasks got at least one finding, 3 got none;
- 12 had at least one blocker at the first review, 21 blockers in total;
- only 4 went through in a single round.
Two cases show what no command would have seen. On an offline save, 3 of the 5 new tests read the state before the cache library had propagated the update: they still passed with the code they protected removed. Everything was green; the reviewer saw it by asking whether the tests bite.
In another project, two sessions were working on the same branch. The fix for one task ended up in the other session's commit. The automated checks passed. Only the final reviewer noticed that the commit title did not match the task.
What went wrong
- Reading does not replace running. On a database task, the CLI token was invalid and Docker was missing: the “tests” were regular expressions over the migration text. The reviewer found 6 blockers, then 4 in the second round, by reading alone. Cap reached, chain stopped. Rule since then: a task whose deliverable is SQL does not start without a database it can run against.
- A fix often opens a new bug. A double-tap lock added in the first round was never released: after navigating back, the screen's buttons stopped responding. The fix brief asked for a lock without saying when to release it. Rule since then: a fix brief states the invariant to hold, not only the case at hand.
- The reviewer came back empty-handed, twice in a row. The cause was never reproduced. Since then, its answer is validated against a JSON schema, re-dispatched once if empty, and a failure is reported as is. Nobody ever invents findings in its place.
Every task that hits the two-round cap gets a postmortem. I have six across my projects. They produced the rules above, far more than a third round would have.
How to get started
Create .claude/agents/reviewer.md with only Read, Grep, Glob in tools: that is the simplest read-only setup, enforced by the tool. In its instructions, write down the two categories, the required failure scenario, and the absence of a score. Then, on a real branch:
npm run check # your lint, type check and test command
git diff main...HEAD > review.diffThen ask Claude to hand review.diff and the description of the request to the subagent, or type @ to pick it from the list. Never pass it the conversation. For the full chain, with the agent that writes the tests and the one that codes, see the article on tests written before the code.
Article written with the help of AI, from my daily practice and my projects.
The whole notebook