Skip to main content

How to Review AI-Generated Code Before Shipping It

Review a small proposed change against its callers, failure paths and normal user entry point.

A magnifying glass over an illustrated code change with the headline “Review What AI Wrote”.

You ask a coding assistant to preserve unsent edits when a form fails. The diff adds a retry helper, changes an API response and touches a cache used by two other pages. Most of the code reads well. Review begins by checking whether the change is as small as the behaviour you asked for.

Recreate the requirement before reading every line

Write down a user action and an observable result. “Submit a form with two fields, let the request fail, and confirm that both values remain editable.” Then gather the relevant callers or routes. If a shared helper changed, read the other places that use it. Ask for a smaller diff when extra paths changed without an identified requirement.

Review behaviour and then evidence in this order:

  1. Normal action. The original success path still works and gives the same useful receipt.
  2. Failure and retry. Inputs remain available. A second submission does not unintentionally duplicate work.
  3. Boundaries. Data is validated where it enters, and existing authorisation still applies to reads and writes.
  4. State compatibility. Existing records and older clients still make sense.
  5. Rollout. The change can be deployed or reversed with the migrations and dependencies it actually needs.

Check API names and signatures against your installed package or official docs. A suggestive import can compile in a draft while pointing at an unstable or incorrect contract. Read generated tests too. A test that mocks the save function to always succeed cannot prove what happens when the API fails.

Finish with the report you would want from a colleague

Record what you ran and what it established. For the form, the meaningful result is that inputs survived a failed request and the next successful action wrote one record. A green linter is a different piece of evidence. If you still need provider access or a production-shaped fixture to confirm a behaviour, say what evidence is missing.

Sources

Build a project

© 2026 All rights reserved.