Skip to main content

A Reviewer That Did Not Write the Code

Why This Matters

An agent reviewing its own work in the same session shares its blind spots: it knows what it meant, so it reads what it meant. Testers know this as the reason developers do not sign off their own features.

Independent review

Run the review in a fresh session that gets:

  • the diff
  • the review criteria
  • the project’s CLAUDE.md and rules

and nothing from the session that wrote the code. No reasoning, no earlier attempts, no “I already checked this”.

Several focused passes

One long review of everything finds the obvious and misses the rest. Several short, focused passes find more:

PassLooks only at
CorrectnessDoes the code do what the pull request says?
TestsDo the tests prove the behaviour, including the unhappy path?
SecuritySecrets, permissions, untrusted input
Prompt and schema changesIs there an eval result? Did any category get worse?

Each pass can run in parallel, as a separate headless call.

A review output schema

{
  "findings": [
    { "file": "src/triage.ts", "line": 42, "severity": "major", "pass": "tests", "finding": "No test for a second 'flaky' answer after the retry." }
  ]
}

CI can block on severity: "blocker", comment the rest, and count findings per pass over time.

A real review of this course’s own setup

The reviewer agent on solution/lesson-52-claude-code (read-only tools, three passes, JSON findings) was asked to review the commit that added TestPilot’s Claude Code configuration: the very setup this module describes. It ran in the background, in its own context, and came back with three major and five minor findings:

The reviewer agent’s findings on the Claude Code setup: three major (the hook only checks that a reason file exists, which Claude could write itself; .env said to be readable through Bash; the skill copies cases to a file the eval never reads) and five minor (skill steps in the wrong order, rules that disagree on where the reason goes, a hook that fails open, an injectable CI prompt, outdated step numbers)

Most of it was right, and important. The worst one: the hook only checked that .golden-change-reason existed, and nothing stopped Claude from writing that file itself. The protection depended on Claude choosing not to, which is exactly what a hook is supposed to remove. All of these are fixed on the branch: only a human writes the reason file (hook plus deny rules), the hook also covers Bash and fails closed, the skill writes to the file the eval actually reads, and the CI job skips forks and pins its version.

One finding was wrong. The reviewer claimed .env was readable through a shell command and that the earlier block was “most likely” a human clicking deny. The session showed otherwise: “permission denied · rule from shared project settings”. The reviewer guessed instead of checking, and said so in the word “likely”. That is why the next section matters: a reviewer’s findings are claims, and you check them like any other.

Measure the reviewer

A reviewer is a test tool; measure it like one:

  • Seed bugs: take five known bugs (a missing retry limit, a quote not checked against the input, a test that changes its own assertion…), put each in a branch, and check how many the reviewer catches.
  • Count false alarms: run it on clean, already-reviewed pull requests. Every finding there is noise.

A reviewer that catches 4 of 5 seeded bugs with almost no false alarms is worth gating on. One that flags everything will be ignored within a week.

Exercise

Build two passes (tests and prompt/schema) as headless calls with the output schema. Seed three bugs in branches and record catches and false alarms.

Compare with solution/lesson-52-claude-code, which has the Claude Code setup for lessons 42–52. Its docs/claude-code-demo.md walks you through all of module 6 in one session.