How the Claude Code team verifies what its agents write

AI-generated illustration.
In mid-November Addy Osmani published a short piece on how the Claude Code team verifies the work its agents do, and it's short enough to read twice. The premise is blunt. Claude now writes and reviews about 90% of that team's code, so the question stops being "is the code good?" and becomes "what proof does the agent hand back, and who checked the checker?"
His answer has two halves. The first is which tests are worth an agent's time. The second is a set of habits the team uses to keep its verification honest, and that half is where most of the value sits. This article walks through both in my own words, adds the context from Anthropic's related posts, and holds each idea up against the pipeline I described in Quality at every station: building a software factory, because I'd arrived at several of the same rules the hard way.
One caution up front. Everything below comes from a vendor describing its own process, about its own product. The numbers are theirs and none of them are independently measured. I think the practices hold up anyway, and I'll say where I'm less sure.
What a verification loop is
A verification loop is the agent checking its own output against something it can run, fixing what fails, and only then reporting back. Delba de Oliveira's earlier post on the Claude blog describes it as a cycle of gathering context, acting and verifying results, then looping when the check fails. Type checkers, linters and test runs are the loops you get for free. The interesting ones are the checks you currently do by hand.
Osmani's case for investing in them is about throughput. Without loops, he writes, you can realistically run one or two Claudes at a time, because every result lands on your desk. With them, the number goes to dozens or hundreds. He cites one internal result: on structured file generation, a separate grader scoring Claude's work against a rubric lifted task success by up to 10 points over a standard prompting loop, with the biggest gains on the hardest problems. The number comes without published data, so I read it as a direction.
The other point in his opening is easy to skim past and it matters. Tests, benchmarks and specs used to be expensive to write, so teams rationed them. An agent writes them cheaply, and once written they run as ordinary software, so running them a thousand times costs almost no tokens. Verification has moved from the scarce side of the ledger to the cheap side.
He also closes the loop in the other direction. If an agent keeps failing the same check, his example being a test that scans logs for user data, the fix goes upstream into a hook or a sharper line in CLAUDE.md. That, he says, mostly stops it recurring. I like that he wrote "mostly".
Three kinds of test worth the agent's time
Before naming the three, he names two ways tests go wrong with an agent in the loop. A flaky test teaches the agent that the right response to red is to run it again. A slow test means fewer runs per batch of changes, so when something breaks you can't tell which change broke it. Both are worse with an agent than with a person, because the agent learns the habit faster and repeats it tirelessly.
End-to-end tests
If you can only invest in one kind, Osmani says, make it end-to-end: a real user flow, such as adding an item to a cart, paying and landing on the confirmation page. His reason is that these tests are difficult to fool. The feature either works through the whole path or it doesn't, and when it doesn't, the failure says where.
Unit tests are faster and steadier, and an agent can pass every one of them while the feature is broken, because neither the agent nor the unit test holds the whole task in view. The article's illustration makes the point well: the unit test reports a 30-second timeout, while the end-to-end run returns a screenshot and a sentence about what's wrong on screen.
To make end-to-end testing practical, he recommends giving the agent hands and eyes on the running system through a skill that boots the app and drives it, using the Chrome DevTools Protocol, a simulator or an API harness. A feature map, a list of features from the user's side with their paths, shortcuts, selectors and expected results, doubles as both the agent's guide and its grading rubric.
This one I can vouch for. In my factory the reviewer runs the full suite, end-to-end included, on the merge of the PR with main, and it takes 45 to 50 minutes on one machine. It got added after a PR merged with 14 failing end-to-end tests that CI had filtered out for speed. It's the most expensive check I run and the last one I'd give up.
Property tests
Most tests encode what the author thought might go wrong. A property test starts from a statement that should hold for every input and lets a library generate thousands of inputs trying to break it. Hypothesis does this for Python, fast-check for JavaScript and TypeScript, and proptest for Rust.
The properties he lists turn up in almost every codebase:
- Round trip: encode a value, decode it, and you get the original back.
- Invariant: something that must always be true, such as a balance never going negative.
- Idempotency: running a migration, normalisation or retry twice has the same effect as running it once.
- Equivalence: the optimised version returns the same answer as the slow, obviously correct one.
His argument for these with agents is subtle and I think right. When an agent writes the code and then writes the tests, both carry the same blind spots. Generated inputs aren't created with the same bias as the agent that wrote the code, so they reach the edge cases it didn't think of. They also help in a rewrite where the written spec has drifted from what production does, because the property describes behaviour and the spec no longer can.
Differential tests
For a migration, the old system is the answer key. Feed the old and new versions the same inputs and treat any difference as a bug or a breaking change until proven otherwise. Osmani's practical advice: use random inputs or a sample of real traffic, normalise differences that don't matter (whitespace is his example), and keep an explicit list of the places where the new system is supposed to differ.
Anthropic has published two examples at scale. Their Messages API move from Python to Rust was verified against production traffic, and they describe why parity was hard: the Python version kept changing during the migration, and the model's replies aren't deterministic, so a difference between two outputs didn't always mean a bug. They report the Rust version uses about 70% less CPU per request. And Mike Krieger's port of a Python codebase to 165,000 lines of TypeScript over a weekend ended with a parity check that diffed every command's output against the Python original. Both are vendor accounts of vendor projects, but the method is old and sound.
Run the thing
The second half of the article opens with a line I'd put above every agent setup: running the app end to end matters more than tests. Nobody ships an iOS change without opening it in a simulator, and the same standard applies to the agent.
The team's tools for this are ordinary. Claude uses the Chrome extension for web changes, an iOS or Android MCP server for mobile, computer use for desktop apps, and a locally running service for backend work. The instructions for starting all of that live in a skill named verify, placed in .claude/skills/ as close to the relevant code as possible, with as many of them as the repo needs. Claude knows to run it before committing. Claude Code also ships a built-in /verify skill that, per the docs post, builds, runs, and observes the changes in your application, which is the place to start before writing your own.
The advice that follows is the part people will skip. Make the verify skill fast and reliable, and have Claude stress-test it, because it's your smoke-test harness and everything downstream trusts it. A flaky verify skill teaches the same bad habit a flaky test does, at the very top of the pipeline.
De Oliveira's post adds how the team chains these: /code-review hunts for bugs, /simplify cleans the diff, /verify confirms end-to-end behaviour, and a custom design skill checks UI changes against a DESIGN.md. A habit you have to remember becomes a sequence that runs on its own.
Let failures decide where people look
Nobody can read every change at this volume, so the team uses failure as the filter. Claude runs the checks and tries to fix what fails. When a check still fails after three rounds, Claude stops and asks for a person.
The number three shows up in Anthropic's code review post too, and that post explains why a cap is needed at all. An agent author and an agent reviewer can keep each other busy forever: one PR went through more than fifty rounds of review and fixes overnight before its author stopped it. When they looked at what the reviewer kept flagging, about 59% was code that had been there since its first pass. The reviewer was finding a few more old bugs each round.
My factory uses the same cap for the same reason. Of the 134 PRs since I bound review verdicts to commits, 89 passed in one round, 42 got at least one round of rework, and 5 hit the cap and came to me. Those five are the PRs that deserved my attention, and the cap is what found them.
Two more habits sit under this heading. Code owners write the checks for their own code and tune them until they flag what the owner would flag. And when a check pulls in a reviewer, it has to say why, so the reviewer isn't left reconstructing the concern from the diff.
Run only the checks the diff calls for
The team keeps a reliability checklist of 39 items. Each has a trigger you can recognise from a diff, a check to run, and a link to the incidents or PRs that produced it. The example is "--resume loads old transcripts": when a change touches session storage or message types, someone has to ask whether a new field loads safely, because transcripts written before the change won't have it.
Claude reads the diff and runs only the items whose trigger matches, usually 3 to 10 of them. The design choice I like here is that the checklist carries the institutional memory. The trigger holds the memory of the outage for everyone, and it only costs time on the changes it matches.
One reviewer, tuned
The team improves review by tuning one reviewer. Osmani says a second, more expensive reviewer layered on top of the first is often worse than tuning the one you have. The tuning lives in a REVIEW.md file that tells the reviewer what matters in this code. Later rounds get the context of earlier rounds and of past failures, so each pass builds on the last. He says that's cheaper and finds more.
The code review post describes what a good REVIEW.md holds: what failure looks like in that repo ("for docs it's 'it lies,' for config it's 'it misroutes'"), a cap on nits, paths to skip, and a demand for a file and line as evidence.
Keep the checks out of the change's reach
This is the principle I'd keep if I could keep only one: if a change can edit the check that judges it, the check is broken. Code Review reads REVIEW.md from the pull request's base branch or the default branch, never from the PR's own changes, so a PR can't loosen its own review. To change the rules, you merge the rule change first.
The reason this matters is well documented. METR reported in 2025 that frontier models were reward hacking their evaluation tasks, getting higher scores by modifying the tests or scoring code and similar tricks. An agent under pressure to turn a check green will sometimes change the check. Putting the rules somewhere the change can't write to removes the option.
Three related rules follow from it:
- Reviews bind to a commit. If someone pushes while a review runs, the result describes a tree that no longer exists. A pass on a stale commit means nothing.
- Cheap checks run first. Claude runs the tests, the build and the linter before opening a PR, so it doesn't spend shared CI and review time on a bug it could have caught locally. You can enforce that with a hook that runs the tests when Claude finishes, or with a
/goalof a passing suite. The goal option is neat because a separate model checks the condition after every turn, so the agent doing the work isn't the one deciding it's done. - Flaky tests get no shortcuts. Claude may not skip them, add sleeps or retry until they pass. If it can't find the root cause, it deletes the test and writes down why.
My factory binds every review verdict to the commit it reviewed, and the ship gate reads a marker the review stage wrote after running the tests itself. It never trusts the PR description, because an agent's own account of what it tested is the one thing in the pipeline it can make up.
Turn a new gate on slowly
Every commit in the team's repos is stamped with how it was verified, and the stamp can say "none", so unverified commits can be found with a query. On top of that sits a commit gate that blocks a commit when the session didn't run /code-review or /verify, with three modes: off, observe and enforce.
Observe mode only logs what it would have blocked, so the false positives get reviewed before anyone is stopped by them. Enforce mode blocks, but any commit can explain in its message why it wasn't verified, and after two blocks in one session the third commit goes through so Claude doesn't get stuck. Osmani's explanation is disarmingly honest: Claude Code isn't perfect.
I think that escape hatch is the right call and also the weakest point in the design. It trades a little enforcement for a pipeline that never wedges, and the stamp makes every bypass visible after the fact. Whether anyone reads those stamps is a question the article doesn't answer.
Check the checkers
The team reviews its reviewers. It tracks merged changes that were later reverted, changes a maintainer rejected before merge, and a size-matched set of changes that stayed clean, which is the control that stops a reviewer from looking good by flagging everything.
The formal version is an eval built from past incidents. For each one they rebuild the repo as it stood at review time and write a one-sentence answer key describing the bug. A finding only scores if it describes that bug correctly. Merged, stable changes act as the control against over-flagging, and the tuning set is kept apart from the fixed test set. They also measure recall at three points (raw findings, after verification, and in the final review), which shows whether the pipeline is losing bugs it had already found. A single end-to-end score would hide that.
Findings are also graded by importance. Code Review tags each one Important, Nit or Pre-existing, and the last tag means the bug was there before this PR, so the author isn't blamed for it. The team tunes recall until the next gain would be overfitting the eval instead of catching real bugs.
Turn misses into rules, then prune them
Two routes turn a missed bug into a rule. The first mines human review comments and reverts for recurring patterns. A pattern qualifies only if it shows up in at least two PRs and can be spotted from a diff; three agents then try to disprove it, and a person approves it in a PR. The second replays three bug finders against a PR tied to a known incident. If at least two find the bug, it's detectable. If they miss it on a small diff, that gap becomes a rule in REVIEW.md.
The last instruction in this section is the one most rule systems leave out: rules need cleaning up too. Test suites, verification steps and Markdown rule files only grow, so the team prunes them on a schedule. My own factory post ended with "turn every incident into a rule, then into a check", and I never wrote down the other half.
Where it breaks
The first limit is the evidence. Every number here comes from Anthropic describing Anthropic: the 90% figure, the 10-point grader gain, the code review post's report that merged PRs to Claude Code more than doubled from June to September while the revert share fell by more than 40%. I believe the direction. None of it is a controlled comparison, and the team building the tool has the best possible conditions for using it.
The second is cost. End-to-end runs are slow, and the article's own advice is to keep heavy tests for before commit. My full suite takes most of an hour per PR. A team that can't afford that per change will need to pick which flows get the end-to-end treatment, and the article doesn't say how they choose.
The third is that verification checks what you thought to check. The checklist, the rules and the eval are all built from past failures. They're very good at stopping the second occurrence of a bug and say little about the first. End-to-end and property tests are the parts of this approach that reach beyond history, which is probably why Osmani puts them first.
The last is the escape hatches. A gate that waves through the third attempt, a test that can be deleted when the cause isn't found, a check that "mostly" stops recurrence: each is a sensible trade, and each is a place where a busy team can quietly stop verifying. The commit stamp is the answer, provided someone looks at it.
Building your own
If I were starting from nothing, I'd take the article's ideas in this order:
- Write a
verifyskill that boots your app and drives one real user flow, then make it fast and boring before adding anything else. - Have Claude run tests, build and lint before every PR, enforced by a hook or a
/goal. - Add a
REVIEW.mdon a protected default branch, and make sure your reviewer reads it from there, never from the PR. - Bind every review result to the commit it reviewed.
- Cap fix rounds at three and send whatever's still failing to a person, with the reason attached.
- Add property tests wherever you have encoding, money, retries or an optimised path with a slow reference.
- Stamp commits with how they were verified, and start any new gate in observe mode.
- Build an eval from your own reverts and incidents, with a clean control set, and score the reviewer against it whenever you change it.
- Prune the rules every month or so.
The closing line of Osmani's article is the right summary of where this lands: the job moves from reading every diff to defining what "done" looks like and reviewing the evidence. That's a real job, and it's a harder one than reading diffs. It's also the only one that scales past a couple of agents.
Sources
- Addy Osmani, How the Claude Code team thinks about verification, claude.dev, 16 November 2026; also posted on X
- Addy Osmani, Morgan Westlee Lunt and Qing Wang, How the Claude Code team does code review, claude.dev, 15 October 2026
- Delba de Oliveira, Building verification loops in Claude Code with skills, Claude blog, 22 July 2026
- Claude Code docs: Customize Code Review, Code Review on pull requests, /goal, Hooks
- Anthropic, Migrating the Messages API to Rust
- Claude, AI code migration
- METR, Recent frontier models are reward hacking, 5 June 2025
- Hypothesis and fast-check documentation
- Chrome DevTools Protocol
- Stone Lasley, Quality at every station: building a software factory