Skip to content

Reviewing AI-generated code

Code review’s job doesn’t change when the author was a model. What changes is the failure distribution: a few things go wrong more often with AI-generated diffs than with human ones, and the author’s self-review has to work harder to catch them.

Review AI-generated code the same way you’d review a contribution from a competent, hurried stranger who can’t answer questions afterwards. The standard is unchanged: fit, correctness, tests. What shifts is where the eyes go first.

Everything on code review expectations still applies. The author still owns correctness — “the model wrote it” isn’t a defence. Approve still means safe to merge, not “safe once I check”.

  • Invented APIs and hallucinated types. A confident-looking function call that doesn’t exist. Grep the identifier before you trust it; the compiler catches some, not all.
  • Plausible-but-wrong edits. Correct-shape code that misreads the caller’s intent. The most dangerous kind — reads fine, ships fine, fails at 3am.
  • Silent scope creep. Renamed helpers, reformatted neighbours, tweaked imports the prompt never asked for. Reject the noise even when the noise looks nice.
  • A tighter self-review than usual. You wrote less of this than a normal diff; your first read is the review. Do it before opening the PR.
  • State the intent, not the transcript. What you asked the model to do tells the reviewer what to check.
  • Own the diff, line by line. If you can’t explain why a line is there, delete it. Keep only what you’d defend in review.