Sharing is caring!

The uncomfortable arithmetic of AI-assisted development in 2026 is simple: writing code got faster, and reviewing it became the bottleneck. Faros AI found review time going up, not down, once AI-generated changes entered the pipeline. Veracode found close to half of the AI-generated samples it tested carried an OWASP Top 10 vulnerability. Neither number means the tools are bad. Both mean the diff is now the product.

Here is the checklist I actually use before an AI-written change reaches main. It is not about style. It is about the six ways these changes fail.

Advertisement

HTML source code on a dark screen — reviewing an AI-generated diff

The short answer

Review the change, not the code. Specifically, verify six things in order:

  1. Intent and blast radius — does the diff do only what the task asked?
  2. External truth — do the imports, APIs, and packages actually exist?
  3. Error paths — what happens when the network, the user, or the clock misbehaves?
  4. Frontend traps — hydration, focus, labels, bundle size, i18n.
  5. Tests that can fail — a test that passed on the first run proves nothing yet.
  6. Ownership — can you explain every line without the chat window open?

If a change fails any gate, it does not matter how elegant the code looks. Send it back with the specific gate named.

Gate 1: Read the diff like an incident report

Before running anything, answer three questions: what was the task, what files changed, and what changed that nobody asked for?

AI agents are enthusiastic editors. A request to fix a button often returns a refactored button, a new utility file, a renamed CSS variable, and a dependency bump. Some of that is fine. Some of it is scope creep that will cost you a rollback at 2am.

  • Open the file list first, not the code. Unexpected files are the cheapest signal you have.
  • Check package.json and the lockfile separately. A new package is a security decision, not a formatting detail.
  • Look for deleted tests, skipped tests, and widened TypeScript types. Those are how a change passes CI while removing protection.
  • Check generated files. If the diff touches .next/, dist/, or a lockfile by hand, stop.

Close-up of colorful source code on a computer monitor

Gate 2: Verify every external symbol

This is the gate people skip because it feels paranoid. It isn’t. The USENIX study “We Have a Package for You!” analysed 576,000 code samples across 16 models and found that 19.7% contained at least one hallucinated package name — 205,474 unique fabricated names. Open models averaged 21.7%; commercial models averaged 5.2%. When the researchers re-ran the same prompts ten times, 43% of the hallucinated names appeared every single time.

That reproducibility is what makes slopsquatting profitable: an attacker registers the name the model keeps inventing. Your review process is the last cheap place to catch it.

  • Hover or jump to every unfamiliar import. If the editor can’t resolve it, neither can production.
  • Check that a new package exists, is the one you meant, and has a real maintainer history. Typosquats and slopsquats look almost right.
  • Read the lockfile diff for new transitive dependencies. One line in package.json can mean forty packages.
  • Confirm API signatures against the installed version, not against the model’s memory of last year’s docs.

This is also where a full-codebase reviewer earns its keep. Tools like Greptile index the repository before commenting, which catches the import that exists but is wrong for this file. Diff-only reviewers cannot see that.

Gate 3: Error paths, not the happy path

AI-generated code is optimistic. It handles the response that returns 200 with the expected shape and forgets the four states that actually happen in production.

Ask for each async path: what happens on empty, loading, error, and slow? Then check the specifics:

  • Cancellation: does the effect abort on unmount, or does it set state on a dead component?
  • Race conditions: if two requests overlap, does the older one win?
  • Retries: is there a retry with backoff, or an infinite loop that looks like one?
  • Timeouts: what is the user looking at after thirty seconds?
  • Validation: is the API response checked at the boundary, or trusted because TypeScript said so?

Here is the pattern I see most often. It looks correct, it passes a shallow test, and it fails the moment the user navigates away:

useEffect(() => {
  let active = true;

  fetch(`/api/orders/${id}`)
    .then((res) => res.json())
    .then((data) => {
      if (active) setOrders(data);
    });

  return () => {
    active = false;
  };
}, [id]);

The boolean guard stops the state update, but the request keeps running and errors are unhandled. The better version uses an AbortController and an explicit error state. The model knows this pattern. It just didn’t choose it, because the prompt asked for “fetch the orders”.

Gate 4: The frontend traps

Generic review advice misses the places where frontend changes break. These are the ones I check on every UI diff:

TrapWhat to verify
HydrationNo Date.now(), Math.random(), or browser-only reads during the first render
Client boundary"use client" added for a measured reason, not by habit
AccessibilityLabels, focus order, keyboard activation, visible focus, no div-as-button
ImagesDimensions set, no layout shift, alt text describes purpose rather than file name
BundleNo moment/dayjs/lodash import for one function; check the size delta
i18nNo concatenated sentences, no hardcoded currency or date formats
StateNo duplicated server state in a client store, no derived state kept in sync by hand

Checklist with blue check marks and a pen — code review checklist

Gate 5: Tests that can actually fail

An AI-written test that passes on the first run is a hypothesis, not evidence. The model is very good at writing tests that assert what the code already does — including the bug.

Three checks catch most of it:

  1. Break the code on purpose. Change a return value, delete a guard, and confirm the test fails. If it still passes, the test is decorative.
  2. Look for implementation coupling. Tests that mock every internal call prove the mocks work, not the feature.
  3. Check the assertions, not the coverage. A file can hit 100% coverage and assert almost nothing. Mutation testing — Stryker for JS/TS — is the honest measure.
Advertisement

One more: tests that were skipped or loosened in the same diff that changed the behaviour. That is not a test update; that is a permission slip.

Gate 6: The ownership test

This is the gate that matters more than the other five. Close the chat. Read the diff and explain, out loud, what each block does and why it is there. If you reach a line and say “the model handled that”, you have found the part you do not own yet.

The 3am test is the same idea: when this breaks in production, will you be able to debug it? If the answer is no, the code is not ready — regardless of whether the tests pass.

The checklist, in one table

#CheckReject if…
1Scope matches the taskUnrelated refactors, new deps, deleted tests
2Imports and APIs resolveUnresolved symbol, unknown package, version mismatch
3Empty/loading/error handledOnly the happy path, no abort, no timeout
4Frontend traps checkedHydration risk, div-as-button, unlabeled input
5Tests can failPasses with the logic broken, over-mocked
6You can explain every line“The model wrote that part”

What AI reviewers are good for — and what they are not

The AI code review category exploded for a reason. CodeRabbit pairs an LLM with dozens of bundled linters and SAST tools and reports millions of pull requests processed. Greptile indexes the whole repository before reviewing a diff. Graphite bets on stacked, small PRs. They are useful, and they are not a signature.

Two limits matter:

  • The same system that wrote the change often shares its blind spots. Review running inside the tool that generated the code is convenient, not independent.
  • Review comments are advisory. A bot approval does not transfer ownership to the bot. You still ship it.

My rule: let the bot catch the mechanical stuff — unused imports, missing awaits, obvious injection patterns, style drift. Spend your attention on intent, error paths, and the parts the bot cannot know: product behaviour, accessibility, and whether this change should exist at all.

A fifteen-minute routine that scales

  1. Minute 0–2: file list, scope, dependency diff.
  2. Minute 2–6: read the main diff top to bottom; mark every external symbol.
  3. Minute 6–9: error paths and frontend traps.
  4. Minute 9–12: break one thing and confirm a test fails.
  5. Minute 12–15: explain the change out loud; write the PR description yourself.

Fifteen minutes is not a luxury. It is cheaper than the incident review, and it is the difference between using AI and being used by it.

FAQ

How big should an AI-generated PR be?

Small enough to review in one sitting. Fifty changed lines is a good target, not a hard limit. If the diff is 900 lines, split it before reviewing — the reviewer’s attention is the scarce resource.

Should I let the same AI review its own code?

As a first pass, sure. As the only pass, no. Use a different model or a human for the final gate. Correlated blind spots are real.

Do I need a paid AI reviewer?

Not at the start. Turn on the reviewer bundled with your existing tool, measure whether the comments are useful for a month, then decide. Precision matters more than volume; a bot that cries wolf gets ignored.

What is the fastest way to spot a hallucinated API?

Jump to definition. If the editor cannot resolve it and the package is not installed, stop. Do not ask the model to explain — verify the source.

The bottom line: AI did not remove the need for review; it moved the value of a senior engineer from writing lines to judging changes. Review the change, verify the outside world, break the tests on purpose, and refuse to merge anything you cannot explain.

Read the first post in this series: Context Engineering for AI Coding. For the overall system, see AI Coding Workflow 2026. Next: testing AI-written code.

Images: Openverse contributors (CC0).

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    Hello, my name is Mahmoud Ameara — senior front-end developer and designer, and the founder of mameara.com. Here I share design resources, tutorials, freebies, and practical frontend guides.
    mameara © 2010 – 2026