← writing

You're the Bottleneck: How I Review PRs When Agents Write the Code

Most of the code I ship now starts in an agent session. The agent writes a change in minutes, and it can write ten of them before lunch. My reading speed didn't change, so if every line still has to pass through my eyes, I'm the slowest part of shipping.

So I stopped treating review as one gate at the end where I read everything. For each change I ask what could go wrong, and which check should catch it: the agent's, a bot's or mine. That turns review into layers, each catching bugs the others miss, with every incident feeding back into the review skill.

  change
    │
    ▼
  ┌──────────────────────────────────────────────────┐
  │ 1  agent proves it     tests, build, screenshot  │
  ├──────────────────────────────────────────────────┤
  │ 2  review skill        fresh context, our rules  │ ◄──┐
  ├──────────────────────────────────────────────────┤    │
  │ 3  bot review on PR    bugs + security, blocks   │    │
  ├──────────────────────────────────────────────────┤    │
  │ 4  CI                  lint, types, tests        │    │
  ├──────────────────────────────────────────────────┤    │
  │ 5  human, by risk      me, when it matters       │    │
  ├──────────────────────────────────────────────────┤    │
  │ 6  small merges        flags, fast revert        │    │
  └──────────────────────────────────────────────────┘    │
    │                                                     │
    ▼                                                     │
  production ──► incident ──► recorded, fixed ────────────┘

  each layer misses some bugs. what gets through
  becomes a new rule for the review skill.

1. Make the agent prove it

Most of my review happens before a PR exists. When an agent says a task is done, I don't take its word for it. I ask it to show me something I can check: the test run, the build output, a screenshot of the page next to the design.

  agent: "done, the bug is fixed"
     │
     ▼
  me: "show me"
     │
     ├─► failing test, now passing      ✓
     ├─► build output, no errors        ✓
     └─► screenshot of the fixed page   ✓

Boris Cherny, who created Claude Code, puts the quality gain from giving the agent a way to verify its work at two to three times. What counts as verification depends on the change. For a CLI it might be one shell command. For a UI it's a browser. The point is that the agent runs it, not me.

2. Build a PR review skill for your codebase

A generic reviewer knows what a bug looks like in general. It doesn't know what breaks in your project. That knowledge lives in a PR review skill: a set of instructions the reviewing agent loads, specific to this codebase.

The agent runs the skill in a fresh context before I open the PR, and again on the PR itself. The agent that wrote the code has spent the whole session convincing itself the approach is right. A fresh one only sees the diff, the stated goal and the skill, so it catches what the author talked itself past.

The useful part of the skill is the project's own complexity, the checks a general reviewer would never think to run. For example, for a cross-platform CLI that looks like:

  • Run the change on VMs across macOS, Linux and Windows, because the same code can pass on one and break on another.
  • Try it in different shells and terminals. zsh, bash and PowerShell quote differently, and terminals disagree on colors, widths and key codes.
  • Watch for path separators, line endings and file permissions.
  • Send a long session with a 1M+ token context through it, and check memory and CPU before and after.
  • Check that it works with every model provider, since each one has its own quirks around tools and streaming.

A web app has a different list, such as phone widths, dark mode or slow networks. Whatever is on yours, write it down in the skill, so a check that used to live in one senior engineer's head runs on every PR.

  pr-review/
  ├─ SKILL.md           what failure means, how to report
  ├─ checks/
  │  ├─ platforms.md    VMs: macOS, Linux, Windows
  │  ├─ terminals.md    shells, terminals, rendering
  │  ├─ performance.md  1M+ token sessions, memory, CPU
  │  └─ providers.md    tools and streaming per provider
  └─ incidents.md       past incidents, and how to spot them

The skill also sets how findings are reported. It says which paths to ignore and how much nitpicking to skip. It asks for a file and line on every finding, and a plain "no issues" when there are none.

Not everything belongs in the review skill. A convention the agent keeps breaking while it writes code goes into the project's agent instructions (AGENTS.md or CLAUDE.md), or into memory. In Command Code that's taste: the agent learns your preferences from how you correct it, so the same note doesn't come up again. A mistake a machine can detect without judgment becomes a lint rule.

3. Keep the review skill alive

A review skill goes stale quietly. The code moves on, and the skill keeps pointing at files that were renamed, checks for problems fixed months ago, and misses the risks that came in since. A stale skill is worse than none: it nags about old things and gives you false confidence about new ones.

So I treat it like code, and I'm strict about it. Changes to it go through a PR. When the architecture changes, the skill changes in the same PR. Rules that no longer apply get deleted, not left around.

I also give the agent freedom to edit it. When a review turns up something the skill should have known, the agent proposes the update itself:

  a review happens
     │
     ├─► I catch a bug the skill missed
     │      agent adds a check for it
     │
     ├─► a finding is dismissed as noise, again
     │      agent narrows or removes the rule
     │
     ├─► a rule points at code that's gone
     │      agent updates or deletes it
     │
     ▼
  skill change lands in the same PR, I approve it

The agent does the upkeep, which is the part people skip. I still approve every change, so the skill doesn't drift into whatever the agent finds convenient.

4. Let a bot read the diff first

Every PR gets a review from the skill before I look at it, plus a separate security review. Both block the merge while a finding is open. The author either fixes it or closes the thread with a reason, which is how false positives get handled.

I want findings sorted, not dumped. Each one should be marked as important, a nit, or pre-existing, so nobody gets blamed for a bug that was already there before the PR.

  PR opened
     │
     ▼
  ┌ bug review ─┐   ┌ security review ┐   ┌ CI ──────────┐
  │ important   │   │ open finding    │   │ lint, types, │
  │ nit         │   │ blocks merge    │   │ tests, build │
  │ pre-existing│   │                 │   │              │
  └──────┬──────┘   └────────┬────────┘   └──────┬───────┘
         └───────────────────┼───────────────────┘
                             ▼
          every thread fixed, or closed with a reason

The PR description has to carry its weight too. Mine has a "How to Test" section and a "Proof" section, and I'd add "how to revert" for anything risky. An agent can fill these in, but the author is the one answering for them.

5. Spend human review on risk

A copy fix and a change to the auto-updater are not the same PR, so they shouldn't get the same review. The tier comes from what the change touches, not from who wrote it.

  risk          example               review
  ──────────    ──────────────────    ──────────────────────
  low           docs, copy, styles    bots + CI, I skim
  medium        a feature, a fix      I read the intent
                                      and the tests
  high          auth, billing, CI,    a second human,
                installers, updater   line by line

A few rules keep this honest:

  • Bot approvals never count as a human approval.
  • An approval is good for one commit. If an agent pushes after I approve, or someone resolves a merge conflict by hand, it needs a new approval.
  • If an agent authored the PR, the person running the agent is one of the reviewers. Someone answers for every change, whoever typed it.

On GitHub, CODEOWNERS and branch protection cover most of this.

6. What I still read myself

Automation is good at "does this code do what it says". It's bad at "should this code exist". So my attention goes to the questions only a person on the team can answer:

  • Should we build this at all? Does it fit where the product is going?
  • Does it touch something dangerous, like billing, auth, the updater or CI?
  • Does it set an architecture or a convention that other code will copy?
  • Does the proof show what the author says it shows?

If I can't say what the automated checks would miss on a PR, I don't give it a quick 👍. Either it's low risk and the checks cover it, or it needs a real review.

The best time to push back is early. Agents make it cheap to start work, which also makes it cheap to start the wrong work. A comment in the thread before the PR is polished ("we tried this in March, here's why it didn't work") saves more time than a blocking review at the end. And since the code was cheap to write, closing the PR doesn't feel like a loss.

7. Make review converge

When an agent writes the code and another agent reviews it, they can go back and forth all night. In their write-up on code review, the Claude Code team describes one PR that cycled more than fifty times between an agent author and an agent reviewer before someone stopped it. When they ran git blame on what the reviewer kept flagging, about 59% of it was code that had been there since the first pass. The reviewer wasn't finding new bugs. It was finding a few more old ones each round.

A nit costs a human one second to dismiss. For an agent author, the same nit means another commit and another review cycle. So I set limits:

  round 1   full review of the whole diff
  round 2   review only what changed since round 1
  round 3   review only what changed since round 2
     │
     ▼
  still failing? stop and rethink the approach
  • After three rounds, the author steps back and rethinks the approach instead of patching again.
  • After the first round, review only the new diff.
  • Report the class of bug, not one line, so the author fixes every instance in one pass.
  • Don't report the same finding twice.

8. Make mistakes cheap to undo

Some bad changes will get through every layer. This layer is about catching them fast and undoing them faster:

  • Keep PRs small, so they're easy to review, debug and revert.
  • Put new features behind flags, and turn them on for the team first. We use our own product all day, so we often notice a regression before users do.
  • Use a merge queue, so two green PRs can't combine into a broken main.
  • Make reverting one step.

The rule that ties it together is "you land it, you own it". If my change breaks something, I usually fix it, because I have the most context on it. That isn't blame, and it leads straight into the last step.

9. Turn every incident into a review check

An incident is the most expensive bug report you'll get, so don't waste it. Every one goes through the same steps:

  incident
     │
     ▼
  record it ──── what broke, which PR, how we noticed
     │
     ▼
  resolve it ─── revert or fix forward, the author owns it
     │
     ▼
  ask which layer should have caught it
     │
     ├─► review skill   add a check, or the case itself
     ├─► CI             add a test
     └─► lint           add a rule

Recording comes first, before the fix, while the details are fresh. Then resolve it. Then ask which layer should have caught it, and change that layer. Most of the time it's the review skill, which is why the skill has an incidents.md: what happened, what the bad change looked like, and how to spot the same thing in a diff.

Over time the incident PRs pile up into something more useful: a test set for your reviewer. Each one is a real change with a known bug in it. Whenever the skill, its prompts or the model behind it change, rerun the review on every past incident PR and check it still catches them. If a rule tweak makes the reviewer miss a bug it used to catch, you find out before the next incident.

Learning the code without reading every diff

Review used to be how I learned the codebase. Reading a teammate's diff showed me what changed and how the system fit together. When bots do most of the reading, that goes away.

I don't miss it much. Reading a one-line copy change teaches you almost nothing. When I need to understand a part of the code, usually right before I change it, I ask the agent to explain that exact slice. It takes a few minutes, and it's always up to date, which a design doc rarely is.

  old way                       now
  ───────────────────────       ───────────────────────
  read every diff to keep       ask the agent to explain
  a mental model of the         the slice I'm about to
  whole codebase                change, when I need it

Where to start

You don't need all of this at once. If I were setting it up on a new repo, I'd go in this order:

  1. Give the agent checks it can run, and list them in a short AGENTS.md.
  2. Write a PR review skill with your project's own checks, like platforms, terminals or providers, and let the agent propose edits to it.
  3. Run it on every PR with a security review, and require every thread to be resolved before merge.
  4. Add "How to Test", "Proof" and "How to revert" to the PR template.
  5. Define risk tiers by path, starting strict, and mark auth, billing, CI and release files in CODEOWNERS.
  6. Cap review rounds, and review only the new diff after the first.
  7. Record every incident, resolve it, and add it to the review skill and its test set.

The goal is less human effort per change without the revert rate going up. If reverts climb, you didn't save any time. You just moved it from review to fixing bugs.