# How to review AI-generated code without anything slipping through

> Guide to reviewing agent code: the three-pass technique, CodeRabbit as first filter and the typical failures AI commits with confidence.

- Canonical: https://serchai.com/en/guides/ai-code-review/
- Site: Serchai (https://serchai.com) — AI tools comparator
- Language: en
- Updated: 2026-07-25

---

## Tools you will use

- [CodeRabbit](https://serchai.com/en/reviews/coderabbit/) — Automatic pull request review with context: it comments before a human arrives.
- [Claude Code](https://serchai.com/en/reviews/claude-code/) — Anthropic's coding agent: works in your terminal, your IDE and the web.
- [GitHub Copilot](https://serchai.com/en/reviews/github-copilot/) — The coding assistant built into GitHub and your IDE, from $10.

## The steps, in short

1. **Let the machine catch the mechanical first** — An automatic pull request reviewer filters the obvious errors before spending your attention.
2. **Review with the three-pass technique** — Change perimeter, tests and fine reading of the logic, in that order.
3. **Know AI code's characteristic failures** — Agents fail in recognizable patterns, and knowing them turns your review into a directed search.
4. **Turn every finding into prevention** — What you catch in review goes back into the instructions file so it does not repeat.

> **TLDR:** Agent code arrives in volume and with a confidence that invites trust, and there lies the trap: AI fails in patterns of its own that classic review does not look for. The system: CodeRabbit as the automatic first filter of every pull request, your review in three passes (perimeter, tests, logic) and every finding converted into a permanent instruction. Review is not the agent's toll: it is your half of the work.

This guide is for developers already delegating to agents who notice the bottleneck has moved: it is no longer writing, it is reviewing. It is the natural consequence of the system built in the [first project with agents](https://serchai.com/en/guides/ai-first-agent-project/) guide, and it deserves its own technique.

The presiding principle: the volume of generated code does not lower the standard of what gets merged. It changes how you review, not how much it matters.

## 1. Let the machine catch the mechanical first

The first pass should not be yours. [CodeRabbit](https://serchai.com/en/reviews/coderabbit/) reviews every pull request as it opens: it summarizes what changes, flags probable bugs, edge cases and obvious security problems, and comments line by line with project context. Free for open source and from about $24 per developer on private repositories.

The effect on your review is a filter: by the time you arrive, the mechanical is flagged and your attention goes to what the machine does not see. And there is a symmetry that works: one AI reviewing another is not redundancy, because the reviewer carries neither the generator's context nor its decisions, and sees the change with clean eyes.

If your team already lives in GitHub with [Copilot](https://serchai.com/en/reviews/github-copilot/), its integrated PR review covers part of this filter at no extra cost: shallower, same first-pass function.

## 2. Review with the three-pass technique

Effective review of agent code has an order, and the order is what makes it sustainable at volume.

First pass, the perimeter: look at the list of touched files before any line. Does the change touch what the task asked and nothing else? The classic agent drift is the fix that takes the opportunity to "improve" things nobody requested, and that excess is detected in ten seconds looking at the perimeter, not reading diffs.

Second pass, the tests: do they exist, pass and test what matters? The generated test has its own pathology: the one verifying that the code does what it does (tautological) instead of what it should do. Reading the assertions with that specific suspicion is the vaccine.

Third pass, the logic: now yes, the fine reading of the new code, with special attention to the edges (empties, nulls, errors, concurrency), which is exactly where generated code trusts most and checks least.

## 3. Know AI code's characteristic failures

Agent code does not fail like human code, and knowing its pathology directs the search. The classics: plausible invention (the library function that does not exist, the parameter that sounds right), edge confidence (the impeccable happy path and the unhandled edge), silent duplication (reimplementing what the project already had, for not having found it), and confident obsolescence (the pattern from three library versions ago, written with total assurance).

Each has its cheap detector: dependencies and imports verify in seconds, edges get asked systematically (what if it comes empty?), duplication gets caught with a name search, and the obsolete surfaces when the tests actually run.

The advantage of this known pathology: your review stops being general reading and becomes directed search, which is faster and catches more.

## 4. Turn every finding into prevention

Review that only corrects is half the system. Every caught failure is information about what the agent did not know about your project, and its natural destination is the repository's instructions file: the convention it violated, the library it should have used, the house's error-handling pattern.

That cycle (failure, correction, instruction) is what stops the same error returning, and explains why teams months into agents review less and less of the same thing. A mature instructions file is accumulated review.

With review solved, the system scales toward volume: the [parallel agents](https://serchai.com/en/guides/ai-parallel-agents/) guide multiplies the work with review as the conscious limit, and [security of generated code](https://serchai.com/en/guides/ai-code-security/) goes deep on the pass that admits no shortcuts. The whole sector lives in [AI for software development](https://serchai.com/en/ai-for/software-development/).

## Common mistakes

Approving on accumulated trust. It is agent review's terminal failure: every success erodes the discipline, and the cost arrives concentrated on the day you should have read.

Reading the diff line by line from the start. Without the perimeter pass first, you spend attention on changes that perhaps should not exist, and arrive tired at the logic that mattered.

Trusting that tests pass. The tautological test always passes: verify the assertions, not the green color.

Correcting without updating the instructions. The same failure will return next session, because the conversation is forgotten and the file is not.

## Frequently asked questions

### How long should reviewing an agent's work take?

With the automatic filter and the three passes, a medium task reviews in minutes. If review takes longer than doing the task, the task was badly sliced or the trust rung badly chosen.

### Is AI reviewing AI not a vicious circle?

No: the automatic reviewer shares neither the generator's context nor its decisions, so it sees the change with clean eyes. The generator, automatic reviewer and human combination is well-built redundancy.

### Which AI failure is the most dangerous?

Plausible invention in dependencies and APIs, because it compiles badly or fails at runtime in strange ways, and the confidence it is written with disarms suspicion. Verifying imports and functions is the most profitable pass.

### Can I skip review on trivial tasks?

You can decide trust rungs with light review, and even there the perimeter and tests get looked at. The day the trivial task touches a file it should not, that ten-second glance is what catches it.
