How to review agent-written pull requests with layered AI review and risk-based human approval
Confirmed by source: Anthropic's Claude Code team describes the review process they run in production on their own repositories, with before/after figures on merges, reverts and review rounds, plus an adoption checklist for other teams. (checked 2026-10-17)
The problem
Once coding agents open pull requests, there are far more changes than people can read line by line, but skipping review lets bugs and risky changes slip into production.
Tools needed
- Claude Code (/code-review, /security-review)
- Code Review for Claude Code or the Claude Code GitHub Action
- CLAUDE.md and REVIEW.md files
- CI, branch protection, CODEOWNERS and a merge queue
- Feature flags for staged releases
Step-by-step recipe
- Before a PR exists, give the agent something it can run (tests, build, linter, a screenshot to compare) and have it show the output; list those checks in a short CLAUDE.md and let a fresh-context subagent or /code-review and /security-review look at the diff.
- Write a short REVIEW.md per area that says what a real failure looks like there, caps nitpicks, lists paths to skip and asks for file-and-line evidence; whenever the reviewer repeats the same comment, fold it into REVIEW.md, a lint rule or a skill.
- On every PR, require CI plus an AI reviewer (start on one repo, tune for a few weeks, then widen) and an automated security pass; block the merge until every finding is either fixed or resolved with a stated reason.
- Set human approvals by risk tier decided from the change, not the author: none for low-risk docs or flagged additive changes, one person for ordinary or sensitive changes, two for the riskiest paths; use CODEOWNERS so auth, billing, CI workflows and installers always need a person, and never count a bot approval as a human one.
- Cap review rounds (the team uses three before asking the author to rethink), re-review only the new diff after the first passes, and avoid reposting findings already raised.
- Merge through a queue that re-runs checks on the latest main, ship behind flags to internal users first, release in stages, keep one-step rollback, and turn every incident or revert into an eval case the reviewer is rescored against.
Copyable prompt
REVIEW.md for [REPO OR DIRECTORY] What a real failure looks like here: [e.g. wrong totals in billing / config that misroutes traffic] Always flag: [SECURITY OR DATA-LOSS PATTERNS], changes that make CLAUDE.md out of date. Skip: [GENERATED PATHS, VENDORED CODE, LOCKFILES] Nits: at most [N] per review, tagged as Nit. Every finding must cite a file and line as evidence and be tagged Important, Nit or Pre-existing. Start the summary with the number of findings and say plainly when there is nothing to fix. After round 3, stop listing new nits and ask the author whether the approach should change.
Original template written by our AI agent for AgentRecipes, not copied from the source. Replace the [BRACKETS] and {{variables}} with your own values and test before relying on it.
What the builder reported
The Claude Code team reports that from June to September merged pull requests more than doubled while the share that had to be reverted fell by more than 40 percent; after capping review rounds, PRs passing after one review round rose from 65% to 78% and mean reviews to pass fell from 2.08 to 1.32.
These are the source author's own claims. AgentRecipes has not run this recipe itself.
Watch out for
- An agent author and an agent reviewer can loop for dozens of rounds; the source reports one PR going through more than fifty overnight, so cap rounds and track rounds-to-pass.
- Noisy reviewers cost more with agent authors, because the agent fixes every nit and triggers another review round; measure how people respond to comments, not just bugs caught.
- Lighter approval paths only work with trusted authors, small reversible changes, flags and fast rollback; without those, keep a human on every merge.
- Code Review for Claude Code is listed for Team and Enterprise plans; on other plans use the GitHub Action or local slash commands.
Source
Original write-up: claude.dev (Anthropic engineering blog) (2026-10-15) ↗
Found via Agent Use Cases: “Review AI-written code with a layered agent review process”. This recipe summarises the source in words written by our AI agent; read the original for the full details. Link last checked 2026-10-17.
More engineering & security recipes
New agent recipes in your inbox
A short email with the newest automation recipes, each linked to its real-world source. No spam. Every email has a one-click unsubscribe link.