How the Claude Code staff does code assessment / claude.dev Weblog

We’ve stated earlier than that Claude writes about 90 % of Claude Code’s personal code. So how will we assessment code on the quantity we produce it? Does anybody learn code anymore? And if one thing breaks, who catches it?
This submit covers the code assessment circulate on the Claude Code staff and the way it has advanced. From June to September, merged pull requests to Claude Code’s codebase greater than doubled whereas the share that needed to be reverted fell by greater than 40 %.
We did not take away assessment. But we did transfer a lot of the studying to machines, optimized for human time and a focus, and invested closely in making it quick and straightforward to undo errors.
RETHINKING THE PURPOSE OF CODE REVIEW
When brokers write code, the variety of adjustments goes up, quick. In Anthropic’s monorepo, adjustments touchdown per day went from about 2,500 in May to more than 30,000 in September this 12 months.
Claude Code lives in its personal repository, separate from the monorepo, but it surely’s seeing a whole lot of strain too. When you might be delivery this quick, guide, line-by-line code assessment is extremely troublesome if not unimaginable.
Code assessment does two jobs:
- Find and repair points earlier than they ship
- Build shared context and codebase understanding throughout the staff
This article primarily focuses on discovering and fixing points, however we are going to come again to the second job close to the tip.
We assume “did a human learn the code?” is an imprecise proxy for “what might go fallacious with this variation, and which verify—automated or human—is the fitting one to catch it?”
Asking that query additionally modified when assessment occurs. Before, assessment was a gate on the finish of the street: write the code, open a PR, wait to your colleague.
Now, assessment runs repeatedly, extra like spellcheck whilst you write. Most adjustments have been reviewed and stuck by Claude at the very least as soon as earlier than a human is requested to look. This catches most routine errors, and saves staff consideration for higher-level questions and scrutiny.
THE SCARCE RESOURCE: HUMAN TIME AND ATTENTION
We wish to protect human time and a focus for points solely people can resolve and ensure automated checks catch the remaining. At our present fee of change, there may be nonetheless an unbelievable quantity of labor for people to do, and our staff encounters new and novel challenges virtually every day.
Human time covers each side of assessment’s value: the time individuals spend reviewing, and the time they spend fixing what dangerous code breaks. Cutting the primary does not assist if the time simply exhibits up within the second.
So the aim is that the majority pull requests within the Claude Code repos (the CLI, the desktop and net apps, and the cellular apps) merge with at most one human within the loop, who will be the creator, with no enhance in reverts or incidents. To measure human time, we observe human approvals per PR (median and ninety fifth percentile), human feedback, and the way lengthy a PR waits on an individual. Revert and incident charges are the guardrail: in the event that they rise, we have not saved human time, we have solely moved it.
THE LIFE OF A CHANGE
A typical change, from an engineer’s laptop computer (or a Claude session in Slack), goes by means of a number of layers of code assessment.
A typical Claude Code change, from the creator’s machine to customers
LAYER BY LAYER
Six layers of checks, with rollback beneath them
1. The work is verified earlier than anybody else seems
Most assessment now occurs earlier than a PR exists. We give Claude one thing it could actually run—like checks, a construct or a screenshot to check in opposition to the design—and ask it to indicate the output as a substitute of claiming it is finished. Then a subagent evaluations the diff with contemporary context. Both habits come from our best-practices guide.
Before opening a PR, many people additionally run a couple of inside abilities: one hunts for bugs, one simplifies the diff, and one checks the habits finish to finish. UI adjustments additionally get checked in opposition to our design pointers.
Boris Cherny, who created Claude Code, has known as giving Claude a method to confirm its work probably the most important thing for getting good outcomes. He estimates it makes the ultimate outcome two to 3 occasions higher, and writes, “Verification seems completely different for every area. It may be so simple as operating a bash command, or operating a check suite, or testing the app in a browser or telephone simulator.”
When the automated reviewer retains flagging the identical factor, we repair it on the supply: within the talent, with a lint rule, or with updates to educational information akin to:
CLAUDE.mdtells Claude what the undertaking is: the stack, the conventions, the targets and the non-goals. Every assessment masses it, so in a big codebase we hold it brief and level to different docs from there. The reviewer additionally flags code that breaks a conference in it, and adjustments that make a line in it old-fashioned.REVIEW.md, written by code house owners, tells the reviewer what issues of their a part of the code. We verify individually whether or not the reviewer truly follows it. The good ones are brief. They say what failure seems like in that repo (for docs it is “it lies,” for config it is “it misroutes”), cap the nits, checklist paths to skip, and ask for a file and line as proof as a substitute of a guess from a reputation. They additionally ask for a abstract that begins with a depend and says plainly when there’s nothing to repair.
2. AI assessment on each pull request
Every pull request will get a Claude assessment earlier than an individual seems. It reads the diff in opposition to the entire repo and the PR’s said intent, and asks: does the change resolve its downside, match the system, or break one thing else?
On a bug repair, it seems for the basis trigger. The public model, Code Review for Claude Code, is now typically accessible on Team and Enterprise plans, and /code-review runs a lighter model regionally.
When we launched the research preview, the share of inside PRs getting substantive assessment feedback went from 16% to 54%. Most PRs over 1,000 strains get findings, and most small ones come again clear. Admins set every repo to Quick, Standard, or Deep. Deep is value it the place one missed bug prices greater than the additional assessment time.
Findings get verified by different brokers earlier than people assessment them. Several brokers search for bugs on the similar time. Then a separate group votes on every discovering, and it solely will get posted if sufficient of them agree it is actual. Findings which can be solely about type, diagnostics, or cleanup get dropped. We A/B examined these filters on our personal PRs earlier than holding them. What’s left exhibits up as inline feedback sorted by severity. Each is tagged Important, Nit, or Pre-existing, so a bug the PR did not introduce does not seem like the creator’s fault.
Every discovering must be answered. You both repair it or resolve the thread with a purpose. Often an agent picks up the repair in a single day, so the creator comes again to a PR that is already been by means of one other spherical.
3. Security assessment that may block
Security will get its personal automated assessment too. A PR cannot merge whereas any discovering from the bug assessment or the safety assessment continues to be open. You both repair it or shut the thread with a brief purpose, which is the way you clear a false optimistic.
If a later commit fixes the problem, the discovering clears by itself. You can arrange the identical factor with the open-source safety assessment GitHub Action or the /security-review command. Setup is roofed in automated security reviews in Claude Code.
4. Automated checks that block
The typical: lint, kind checks, checks on each platform, and a construct. (We wrote about scaling CI for this quantity here.) A typical CLI pull request could run dozens of checks earlier than anybody seems at it. The PR template asks how the change was examined and find out how to undo it. Claude can fill that in, however the one that requested for the change indicators off on it.
5. Human approval, scaled by threat
A docs repair and an auto-updater change carry completely different threat, so that they get completely different assessment.
| Risk | Examples | Human approvals |
|---|---|---|
| Low | Docs, copy, internal-only options, additive adjustments behind a flag | None required as soon as automated assessment and safety checks are inexperienced |
| Medium | Ordinary product adjustments, and adjustments to delicate areas akin to caching, the auto-updater, or system prompts | One particular person |
| High | The highest-risk code, plus a small set of paths that all the time want two individuals | Two individuals |
The change units the tier, not the creator. A classifier reads the change and picks its threat tier. A second classifier asks whether or not this explicit change wants one other particular person even when its tier says it does not. Some paths all the time want an individual, something house owners have listed as delicate and any CI workflow file.
Only trusted authors get the lighter paths. Only authors on the repo’s trusted checklist get the lighter paths, principally the staff that owns it. Everyone else wants a second particular person to approve. An agent’s approval by no means counts as an individual’s, both. Automated assessment can clear a low-risk change, however it could actually’t fill a slot that requires a human.
Whoever prompted the change is on the hook for it. On an agent-written PR, the particular person directing the agent counts as one of many required reviewers, the identical as in the event that they’d typed the code themselves.
An approval covers one particular commit. If new commits land that the system cannot vouch for, like an agent’s push or a merge somebody resolved by hand, the approval must be given once more.
6. Merge queue, flags and a gradual launch
The merge queue re-runs each verify in opposition to important with the change utilized, so two PRs that cross individually cannot mix right into a damaged important. New habits normally ships behind a flag to Anthropic staff first, and our heavy use usually surfaces regressions earlier than customers do. Public releases go to the newest channel first. The secure channel trails it.
7. Fast detection, quick rollback
Some errors will nonetheless get by means of, so the final layer is about catching them quick. Flags flip off with out a deploy. Claude Code has a weekly on-call rotation, and incident evaluations ask which layer ought to have caught the problem.
Noticing a nasty merge nonetheless is determined by the creator and on-call in addition to the revert and incident dashboards. We do not but have circuit breakers that tighten approval when these numbers transfer; engineers right here need them earlier than extra code strikes to zero-human merges.
One colleague stated slowing down does decrease your error fee, however principally since you’re doing much less of the whole lot. We’d relatively get sooner at noticing and fixing issues.
HOW WE MAKE THE REVIEWER BETTER
Our code assessment course of is consistently bettering in a loop.
Any incidents are actually an eval. The staff collected previous PRs that brought on incidents, with their fix-forwards and reverts, and had engineers who know that code verify every bug and the place it lived. The reviewer runs in opposition to that set every day.
Our incidents are the eval
Built from previous incidents and reverts, run on daily basis
We measure noise by watching what individuals do with the feedback. It’s simple to catch extra bugs in the event you do not thoughts flagging a whole lot of non-bugs, so we want a verify on that. We type each remark the reviewer leaves by how the particular person on the PR responded: they mounted it, stated it was fallacious, stated the habits was intentional, or determined it did not matter. We additionally run the reviewer on PRs we all know are clear and depend how usually it stories one thing that will have led somebody to make a dangerous change. Our precedence, written down, is catching actual bugs first and reducing assessment rounds second.
Noise prices extra when the creator is an agent. An individual can wave off a nit in seconds. An agent fixes it, which suggests one other commit and one other spherical of assessment.
Review has to converge. An agent creator and an agent reviewer can hold one another busy indefinitely. One CLI PR went by means of greater than fifty rounds of assessment and fixes in a single day earlier than its creator stopped it.
When we ran git blame on what the reviewer saved flagging, about 59% of it was code that had been there because the reviewer’s first cross. The reviewer was hardly ever discovering new bugs, it was discovering a couple of extra previous ones every spherical.
We made it worse ourselves. We’d gotten used to operating a number of rounds by default, since every cross catches one thing new. This will be worthwhile on a dangerous change, however not on each PR. The staff now tracks rounds-to-pass alongside recall, and altered re-review:
- A spherical cap. After three rounds, the reviewer asks the creator to step again and rethink the strategy.
- Diff-only re-review after the primary few passes.
- Flag the category of bug, so the creator fixes each occasion, not one line.
- No repeats of findings already posted.
Review brokers additionally run nightly over current code, serving to us catch previous bugs earlier than they present up some place else.
Internal pull requests, earlier than and after the convergence adjustments
WHERE HUMANS STAY IN THE LOOP
Pulling a senior engineer out of deep work to catch a routine mistake prices way over an automatic assessment. At Anthropic, our jobs have moved from studying each diff to the choices machines are dangerous at:
- Should we construct this in any respect? Direction, style and scope. One staff that declared its assessment bottleneck solved nonetheless saved human assessment for adjustments from exterior the staff, so somebody asks “ought to we even do that?”
- Risky code akin to billing, the auto-updater and CI workflows.
- Architecture that units a sample others will copy.
- Reading the proof. Test output, the command that ran and what it returned, a screenshot, the reviewer’s findings. If you possibly can’t say what the checks would miss, ask for an actual assessment relatively than a fast approval.
- Owning the end result. An individual is accountable for each change that ships, whoever typed it.
Where an individual decides
Five choices stick with individuals; checks run in all places else
SHARING CONTEXT ACROSS THE TEAM
Code assessment’s second job has all the time been to unfold codebase understanding. Reading a teammate’s diff is the way you study what modified and the way the items match. If machines do a lot of the studying, how does anybody study the code?
We do not have a proper course of for this. Nobody on the staff retains an entire psychological mannequin of Claude Code of their head, and we do not assume anybody must. When somebody desires to grasp part of the codebase, they ask Claude to put in writing an explainer for precisely that slice. It takes minutes and displays the code as it’s at present.
Some of us go a step additional and have Claude construct a small artifact that visualizes that a part of the code and teaches it the way in which that particular person likes to study.
If the aim is to spend human consideration properly, this beats studying trivial diffs line by line. A one-line copy change teaches you virtually nothing. An explainer for the module you are about to vary teaches you numerous. Our tradition of defaulting to engaged on open Slack channels helps too, because you see what others are constructing whereas they construct it.
“YOU LAND IT, YOU OWN IT”
If you land a small or medium change and one thing nonetheless goes fallacious, it is a staff norm that you just normally repair it. A number of issues hold this from going badly:
- Changes are small, so that they’re simple to assessment, debug and revert.
- Everything is reversible. Flags, reverts and staged releases undo most errors in minutes.
- Blast radius units the bar. Expensive code will get extra individuals and extra checks.
- Regressions floor quick by means of telemetry and inside use.
- It is not blame. Owning a repair means you may have probably the most context; incident evaluations take a look at the system.
Ownership can be shared. Much of the staff works in open channels the place anybody can see what others are constructing, decide up a thread, or level a Claude at a niche, and suggestions comes from individuals who do not personal the code too. That openness is a giant a part of how high quality stays excessive with out a gate on each line.
WHEN WE CHANGE DIRECTION
Agents make it low cost to start out issues, so some work should not land. Usually somebody within the channel asks why, factors at an earlier choice, or suggests a less complicated route, and the creator closes or reshapes the PR.
Since the code was quick to put in writing, closing the PR does not really feel like a loss. The trick is to boost a distinct course within the thread early, not as a blocking touch upon a completed PR.
HOW YOU CAN ADOPT THIS PROCESS
Most of the items to do that along with your staff exist at present.
Before the pull request
- Give your agent checks it could actually run, listed in a brief
CLAUDE.md, plus hooks that run formatters and linters. - Run
/code-reviewand/security-reviewregionally, or a fresh-context subagent assessment. - Add a
REVIEW.md, and transfer repeated assessment feedback into it.
On each pull request
- Require CI, and add “Testing”, “Risk” and “How to revert” to your PR template.
- Add an AI reviewer (Code Review for Claude Code, or the Claude Code GitHub Action) on one repo, tune
REVIEW.mdfor a couple of weeks, then widen. - Add automated safety assessment, and require each assessment thread resolved earlier than merge.
- Match assessment effort to threat: a fast cross on routine adjustments, a deep one the place a missed bug is dear (Quick, Standard or Deep in Code Review).
- Cap assessment rounds; after the primary few, re-review solely the brand new diff.
Approval
- Write down threat tiers, set from the change relatively than the creator; begin strict and loosen with proof.
- Keep the lighter approval paths for authors you belief.
- Use CODEOWNERS and department safety so auth, billing, CI and launch workflows, and installers all the time want an individual.
- Never let a bot’s approval change a required human’s; dismiss approvals on new commits.
Merge and after
- Use a merge queue, function flags, inside use first, staged releases and one-step rollback.
- Turn incidents and reverts into an eval set, and rescore the reviewer at any time when its prompts, instruments or mannequin change.
- Measure human time, with revert and incident charges because the guardrail.
WHERE THIS IS GOING
Code Review’s announcement stated approving a pull request continues to be a human name; the product posts findings, not approvals. Our personal repos go additional, letting house owners determine which low-risk adjustments merge on automated checks alone, and that line retains shifting.
When a assessment misses one thing, we ask what the mannequin did not have in entrance of it and put the repair right into a CLAUDE.md, a talent or a brand new verify. The aim hasn’t modified: much less human time per change, and no extra reverts than earlier than.
If your staff lets brokers open pull requests, we might like to listen to which checks you’ve got automated, which nonetheless want an individual, and what you assume we’ve got fallacious.
With because of Emma Webb, Michael Segner and Amie Rotherham for his or her evaluations.
