I asked Claude to review a pull request with six planted bugs. Without the spec it found three. With it, all six.
Nine reviews, six planted bugs, three setups. Claude never invented a problem, but it could only catch what the code itself shows. The thing that moved the score from three to six was one short file saying what the change was meant to do.
3 of 6 bugs found, then 6 of 6 with a spec
Level: Intermediate. About 20 minutes. Needs git and a Claude Code login.
Anthropic's Claude Code team wrote about how they review code, and a lot of it comes down to getting a first pass from Claude before a human looks. I wanted to know how good that first pass is on a small change, and what makes it better or worse.
So I wrote a pull request with six bugs in it, and reviewed it nine times.
The pull request
A "promo codes and checkout" change, 25 lines, on a branch. I added a short PR.md file, the kind of description a good pull request has:
The spec is five lines: free shipping at $50 or more, discount applied before tax, quantities must be whole numbers of 1 or more, the caller's data must not be changed, and promo codes are looked up in the database.
The six bugs:
- SQL built by gluing strings together. The promo code goes straight into the query.
- The caller's list gets reordered.
items.sort()changes the original array. - An unawaited query used as a check. It's always true, so the check does nothing.
- Free shipping at exactly $50 is not free. The code says
> 50, the spec says "$50 or more." - The discount comes after tax, not before.
- Quantity validation is too weak. Zero, negatives and half-items all pass.
Look at which bugs need the spec. Numbers 1 to 3 are wrong whatever the intent was. Numbers 4 to 6 are only wrong if you know what the code was supposed to do.
Three ways to ask
All three used the same instruction: review the branch against main, list the real bugs with file and line, edit nothing. Three runs each.
- No spec. I deleted
PR.mdfrom the branch. - Spec.
PR.mdis there, and the prompt mentions it. - Spec, plus a two-pass method. Pass 1 lists candidates. Pass 2 acts as a sceptic and tries to disprove each one. Only what survives is reported.
The results
With the spec, every run found all six bugs. Without it, every run found the same three and missed the same three.
It wasn't random. The reviewer without the spec caught exactly the bugs you can see from the code alone, and none of the ones that depend on intent. Here's what that answer looked like:
It's a good review. It's also complete as far as it can see. Claude can't flag "free shipping at $50 exactly is wrong" if it doesn't know the rule says $50 or more.
Two more things I noticed:
- No false alarms. In all nine runs, I couldn't find one reported bug that wasn't real. For a first-pass reviewer that matters, because noise is what makes people stop reading.
- The sceptic pass didn't help here, and cost more. It found the same bugs, at about 35 to 57 cents a run against 23 to 35. In one of the three runs it talked itself out of a real bug: it moved the unawaited query to a "noted, not counted" list, on the grounds that the final total came out the same. It's still a wasteful query and a likely unhandled error. A sceptic can be too good at finding reasons.
The sceptic also did one clever thing. For the discount-after-tax bug, it checked whether the order even matters and worked out a concrete case where rounding makes the two orders differ by a cent. I checked that example myself, and it's right.
What I'd do with this
- Give your reviewer the intent. A five-line
PR.md, or the ticket text, or the description. It moved my score from half to full. - Write rules as checkable sentences. "$50 or more" is a rule Claude can test the code against. "Sensible shipping" is not.
- Don't read "no issues found" as "no bugs." Without a spec it means "no bugs visible in the code alone."
- Skip the extra sceptic pass until you have a reason. On this change it added cost and one demoted bug.
- Keep it read-only. I ran every review in plan mode with only git and read tools allowed. A reviewer shouldn't be editing.
What this doesn't tell you
- Six bugs I planted myself, in a 25-line change. They are the kind a spec makes obvious, and real bugs are often subtler. I wouldn't treat three out of three as a catch rate for real work.
- I decided which findings counted by reading the answers. I did not use an automatic scorer, because my first attempt (keyword matching) mis-scored one run.
- Nine runs, one model on one day. The differences between the spec and no-spec setups are large, but the difference between the two spec setups is within what chance could produce.
- Cost per run, as Claude Code reported it, was 23 to 57 cents. I'm on a Pro plan, so I wasn't billed per run.
Sources
- https://claude.dev/blog/solving-code-review-at-anthropic/
Editorial note: We ran the steps in this guide ourselves and the screenshots come from those runs. Your results may differ with your plan, model or settings, so check anything important. Cover illustrations are AI-generated. Discovia is independent and not affiliated with Anthropic.
New guides and tools
Hands-on Claude guides, straight to your inbox
Step-by-step walkthroughs of what's new in Claude and Anthropic's tools, with real screenshots and honest results, including what didn't work. No hype, no jargon, no noise.
By subscribing, you agree to receive newsletter and marketing emails, and accept our Terms of Use and Privacy Policy. You can unsubscribe anytime.
Claude Code Lab
Tests of Claude Code features: hooks, skills, rules files and workflows, with the numbers.
More Claude Code guides →


