I'm Gopi Gugan, a software engineer building AI features with FastAPI, Postgres/pgvector, and React/TypeScript. These days a lot of the code I review wasn't written by a person — it came from an AI coding assistant. That changes what a code review is for. I'm not checking whether the author understands the code anymore. I'm checking whether anyone does. You can find more of my writing at gopigugan.ca.
Here's how I review AI-generated code without slowing my team down — or letting bad code slip through.
Review the diff, not the prompt
The first mistake I made was asking "what did you prompt it?" That's the wrong question. The prompt is gone, the diff is what's shipping.
- Review the code the same way you'd review a junior developer's PR: line by line, with the same standards.
- Don't give AI-generated code a free pass because it "probably knows what it's doing." It doesn't know anything — it predicted text.
- If the author can't explain a block of code in the PR, that's a review blocker, not a minor comment. Whoever merges it owns it.
- Ask for a short PR description of what changed and why, written by the human, not pasted from the tool.
Check the boring stuff first — it's where AI fails
AI-generated code usually looks polished. The bugs hide in the places that look fine at a glance.
- Error handling: does it swallow exceptions, return a success on failure, or retry forever?
- Edge cases: empty lists, null values, off-by-one boundaries, and the second page of a paginated API.
- Security: raw SQL strings, unsanitized input, secrets in logs, and auth checks that exist but never actually run.
- Dependencies: did it add a new package for something the standard library already does? Did it pin a version?
# This looks reasonable. It silently drops every failed row. for row in rows: try: save(row) except Exception: pass # AI wrote this. It "handled" the error. A review comment I write a lot: "This except block hides failures. Log it, or let it fail loudly."
Test what it claims to do
AI code often comes with tests that pass — because the tests were generated from the same wrong assumption as the code.
- Run the tests, but don't trust them. Read at least one test and ask: does it actually assert the behavior, or just that the function didn't crash?
- Add one test of your own for the case you care about most. If you can't write it quickly, the code is probably too tangled to review.
- For anything touching money, auth, or data deletion, I want a test that fails before the fix and passes after. No exceptions.
Keep the diff small, even when generation is cheap
AI makes it trivially easy to generate 500 lines in a minute. That doesn't make a 500-line PR reviewable.
- Ask for the change in the smallest form that works. A focused PR gets a real review; a giant one gets a skim and a rubber stamp.
- If the AI rewrote a whole file to change one function, ask the author to split it: the behavior change in one PR, the refactor in another.
- Watch for "helpful" extras: the model adding features nobody asked for, renaming things for style, or "improving" unrelated code in the same diff.
Use AI in the review, but don't let it be the review
I do use AI review tools — they catch typos, suggest cleaner patterns, and flag obvious issues fast. But they're a first pass, not the decision.
- Treat AI review comments like a linter: useful signal, not a verdict. I still read the code myself.
- Be suspicious when the AI reviewer says "looks good" about a change you don't fully understand. That's exactly the case where a human needs to slow down.
- The final call is always a human's. If I approve a PR, I'm saying I understand it and I'd debug it at 2am. No tool can say that for me.
The takeaway
AI writes code fast, but review is where quality actually happens — and review is still a human job. Read the diff like a person wrote it, check the boring failure modes first, test the claims, keep PRs small, and never approve code nobody on the team understands. The model can generate; only we can take responsibility. That's the part of the job that didn't get automated.

