How to Review AI-Generated Code: A Practical Checklist
A code review checklist for AI-written pull requests: correctness, tests, security, dependencies, performance, consistency and signs of hallucinated APIs.
Published December 1, 2026
AI agents can produce large, plausible pull requests in minutes. Reviewing them well is now one of the most important engineering skills. AI code has characteristic failure modes: confident use of APIs that do not exist, tests that pass without testing anything, subtle security gaps, unnecessary new dependencies and inconsistency with existing patterns. A focused checklist catches most of them.
The concept
Start from intent. Read the task or spec, then the PR description, then the diff. Ask whether the change does what was asked, and only that. AI agents sometimes "helpfully" refactor unrelated code or change tests to make them pass; both deserve scrutiny.
Then review in layers: correctness and edge cases, tests (do they assert meaningful behaviour?), security (input validation, auth checks, secrets, injection), dependencies (new packages, versions, licenses), performance (N+1 queries, unbounded loops), and consistency with codebase conventions. Run the code yourself for anything non-trivial.
The checklist
- Intent: does it solve the stated task and nothing else?
- Correctness: edge cases, error handling, null/empty inputs
- Tests: meaningful assertions? Were existing tests changed?
- Security: validation, authorisation, secrets, injection
- Dependencies: new packages justified, real, maintained?
- Fit: follows conventions, no duplicate helpers
Red flags in AI PRs
| Red flag | Why it matters |
|---|---|
| Imports or methods you have never seen | Possibly hallucinated APIs |
| Tests modified alongside logic to pass | May hide broken behaviour |
| Broad try/except that swallows errors | Hides failures |
| New dependency for a 10-line task | Supply-chain risk, bloat |
| Duplicated utility that already exists | Inconsistency, maintenance cost |
| String-built SQL or shell commands | Injection risk |
Keep AI PRs small
Practical examples
Verify a suspicious API exists
Check the installed version, not memory.
npm ls date-fns && node -e "console.log(Object.keys(require('date-fns')).filter(k => k.includes('Business')))"
python -c "import pandas, inspect; print('read_parquet' in dir(pandas))"Spot weak tests
This test passes for almost any implementation.
test('calculates total', () => {
const result = calculateTotal(cart)
expect(result).toBeDefined() // asserts nothing meaningful
})
// Better: expect(calculateTotal(cart)).toBe(2_499_00)Ask the agent to explain risky parts
Make it surface assumptions.
"List every assumption this change makes about input data, authentication and concurrency,
and point to the lines that rely on each."Common mistakes
- Approving because tests are green without reading what the tests assert.
- Skimming large AI PRs instead of asking for smaller ones.
- Missing unrelated changes bundled into the diff.
- Not running the code locally for UI or integration changes.
Key takeaways
- Review against intent first; reject scope creep.
- Check tests, security, dependencies and consistency deliberately.
- Verify unfamiliar APIs exist in your installed versions.
- Ask for small PRs; large ones get skimmed.
FAQ
Should AI-written PRs be labelled?
It helps reviewers calibrate attention, but the review standard should be the same as for any PR.
Can an AI reviewer review AI code?
AI review bots catch many mechanical issues and are a useful first pass, but human review of intent and design is still needed.
Who is accountable for bugs?
The team that merged the code, exactly as with human-written code.