Reviewing code an AI wrote
It compiles, the tests pass, and it reads well. That combination is exactly why it needs a different kind of review.
Reviewing generated code is not harder than reviewing human code. It is differently distributed: the mistakes cluster somewhere else, and the usual signals that something is wrong are absent.
What is reliably fine
Syntax, idiom, formatting, obvious structure. Reviewing for those is wasted attention now. If your review process spends its energy there, it is defending against the failure mode that went away.
Where the defects actually live
Plausible-but-wrong specifics. A field name that should exist, an argument order that reads correctly, a config key that is almost the real one. Human errors here look like typos; generated ones look right.
The unstated requirement. Generated code satisfies what the prompt said. The constraint nobody wrote down — that this path is hot, that this table is huge, that this call is rate-limited — is not there and left no gap where it should have been.
Error paths. The happy path gets attention proportional to how much of the prompt described it. The failure path is often structurally present and semantically empty: a caught exception, a returned default, nothing that would tell you it happened.
Tests that assert the implementation. Generated tests can be written from the code rather than from the requirement, which means they pass and prove nothing. Read the test without the implementation in view: does it describe behaviour you actually want?
A review order that works
- Requirements first. Read the diff against what was asked, not against itself. Does anything here do something nobody requested?
- Then the boundaries. Empty, one, many, maximum, null, concurrent. This is where the density of defects is highest.
- Then the error paths. For each, ask what a caller learns when it fires.
- Then the tests — as evidence, not as reassurance.
- Style last, and briefly.
The trap
The code reads well, so review feels complete sooner. Fluent prose triggers the same feeling, and it is not evidence in either case.
A useful counter: before approving, name one input you have not seen tested that you believe would break it. If you cannot construct one, you have not looked at the boundaries yet.
Where it genuinely helps
Generated tests for your code — written from the requirement, not the implementation — are one of the better uses available. So is asking for the failing case rather than the review: "what input makes this wrong?" is a question with a checkable answer.
Used in this tutorial
Code reviewer
Reviews a diff for defects, and refuses to pad the list with style opinions.
Review a diff like a senior engineer
Looks for defects and consequences, not style opinions a linter already covers.
Write tests for this function
Table-driven tests covering the boundaries, not just the happy path.
Claude Code
Anthropic's agentic coding tool for the terminal and IDE.
Cursor
An editor built around AI-assisted editing.