{"schemaVersion":"1.0","type":"TechArticle","types":["Article","TechArticle"],"slug":"how-to-review-ai-generated-code-a-checklist-for-teams-wkwyj","url":"https://zyvop.com/how-to-review-ai-generated-code-a-checklist-for-teams-wkwyj","title":"How to Review AI-Generated Code: A Checklist for Teams","subtitle":"A practical checklist for reviewing code written by AI assistants: what to check, what to automate, and the team rules that keep quality high.","tldr":"AI assistants write code fast, but fast isn't the same as correct. This post gives your team a copy-paste review checklist covering scope, hallucinated APIs, security, tests, and maintainability, plus a PR template and Node.js examples of what to catch.","keywords":["security","team workflow","AI coding","software quality","code-review","Programming"],"entities":["Shobit Singh","security","team workflow","AI coding","software quality","code-review","Programming","ZyVOP"],"keyTakeaways":["Treat AI-generated code as untrusted input: read it, run it, and test it before it merges.","The author owns the change, no matter who or what wrote it.","Watch for hallucinated APIs and packages, missing authorization, weak tests, and unrelated edits.","Keep pull requests small and automate everything a machine can check.","Use AI as a first-pass reviewer if you like, but keep a human accountable for the final decision.","A short, shared checklist in the PR template beats an unwritten set of expectations."],"headings":["Why AI-generated code needs extra attention","Ground rules before you review","The checklist","1. Intent and scope","2. Correctness","3. Hallucinated APIs and dependencies","4. Security","5. Tests","6. Design and maintainability","7. Performance and operations","What to catch: an example","Review techniques that work","Red flags at a glance","Make it easy: a PR template","Team policies that help","Key takeaways","Further reading"],"outboundLinks":["https://google.github.io/eng-practices/review/","https://arxiv.org/abs/2406.10279v3","https://www.veracode.com/press-release/ai-generated-code-poses-major-security-risks-in-nearly-half-of-all-development-tasks-veracode-research-reveals/","https://www.techradar.com/pro/security/ai-generated-code-is-still-frequently-failing-security-checks-with-claude-and-gpt-6-topping-the-leader-board","https://owasp.org/projects/top-ten","https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners"],"contentText":"AI assistants can now write a working feature in minutes. The hard part has moved to the other side: someone has to decide whether that code is correct, safe, and something the team wants to maintain. Reviewing AI-generated code isn't a different discipline from normal code review, but it changes where mistakes hide. The code is fluent and confident, and it usually compiles and passes a quick test. That makes problems easier to miss. This post gives you a practical checklist, a few team rules that make reviews work, and Node.js examples of what to catch. It applies whichever tool wrote the code. Why AI-generated code needs extra attention A few patterns come up again and again: It looks right. Clean formatting and confident naming create a false sense of correctness, and reviewers tend to skim code that reads well. It lacks your context. The model doesn't know your domain rules, past incidents, internal libraries, or why a strange-looking workaround exists. It can invent things. That includes functions, config options, and even whole packages that don't exist. It misses security more often than you'd like. Security tests of AI-written code keep finding a large share of vulnerable output. There's a lot of it. Output is cheap, so diffs get bigger and review becomes the bottleneck. The package problem is worth spelling out. A study of 16 code-generating LLMs found that the average share of hallucinated packages was at least 5.2% for commercial models and 21.7% for open-source models. Attackers can register those made-up names and put malware behind them. The models in that study are older now and current rates will differ, but verifying a dependency takes seconds. On security, Veracode's 2025 report found vulnerabilities in 45% of its test cases, and its July 2026 report put the figure at about 44%. An update reported in October 2026 found 38%, which Veracode described as its first meaningful improvement since the study began. That's progress, but it's still more than one in three. These are vendor-run tests on specific coding tasks, and the test sets differ between reports, so treat the exact numbers as a rough guide. The direction is what matters: AI-written code needs the same scrutiny as any other untrusted input. Ground rules before you review A checklist only works if the team around it does too. The author owns the code. Whoever opens the pull request is accountable, whether they typed it or prompted it. They should read and understand every line before asking anyone else to. Keep changes small. AI makes 800-line diffs easy to produce. Ask for smaller pull requests, because nobody reviews a huge diff well. Say when AI was used. This isn't about blame. It tells reviewers where to look harder. One line in the PR template is enough. Let automation do the boring work. Formatting, linting, type checks, tests, dependency audits, and security scans should run in CI so humans can focus on judgment. Protect sensitive areas. Authentication, payments, cryptography, database migrations, and infrastructure should always need review from the people who own them. Here's how those pieces fit together: flowchart LR A[\"AI generates code\"] --&gt; B[\"Author reads and tests it\"] B --&gt; C[\"CI checks: lint, types, tests, security scans\"] C --&gt;|pass| D[\"Human review with checklist\"] C --&gt;|fail| B D --&gt;|changes requested| B D --&gt;|approved| E[\"Merge\"]The checklist Copy this into your PR template or review guide. Not every item applies to every change. 1. Intent and scope The change solves the problem in the ticket or spec, and nothing more. There are no unrelated edits: refactors, renamed variables, reformatted files, or deleted comments. The approach is one the team would have chosen, not just one that happens to work. Any removed or changed behavior is intentional and explained. 2. Correctness The logic matches the business rules, not just the happy path. Edge cases are handled: empty input, null or undefined, very large input, Unicode, time zones, duplicates. Failure paths are handled: timeouts, retries, partial failures. Concurrency is considered: races, double submits, idempotency. There's no placeholder code: TODOs, stubbed functions, or hardcoded sample data. Nothing special-cases the test inputs to make tests pass. 3. Hallucinated APIs and dependencies Every function, method, option, and config key exists in the version you actually use. No deprecated or removed APIs are used. Each new dependency exists, is the package that was intended (watch for lookalike names), is maintained, and has a compatible license. Each new dependency is really needed. The standard library or an existing dependency might already cover it. Lockfile changes match the dependency changes you expect. Don't trust that code is right because it reads well. Check it against the docs or type definitions, and run it. For a new npm package, npm view &lt;package&gt; shows the maintainers and when it was last published, and npm view &lt;package&gt; repository.url shows where the source lives. That's a quick sanity check. 4. Security Input is validated at trust boundaries. Authorization is checked on every access path, not just authentication. There's no injection risk: SQL, shell commands, templates, XSS, or log injection. No secrets, tokens, or credentials appear in code, logs, or test fixtures. Cryptography uses vetted libraries: no home-grown crypto, MD5 or SHA-1 for passwords, or Math.random() for tokens. Error messages don't leak internals. File paths, URLs, and redirects built from user input are constrained, to prevent path traversal, SSRF, and open redirects. Veracode's latest tests found models getting better at cross-site scripting but still struggling with flaws that depend on data flowing across several functions, such as log injection. Those are exactly the bugs that are hard to spot in a quick read, so slow down on them. 5. Tests Tests assert behavior, not implementation details. Tests fail when the code is wrong. Temporarily break the logic and confirm. Edge cases and failure paths have tests. No tests were deleted, skipped, loosened, or rewritten to match new behavior. Mocks don't hide the thing being tested. 6. Design and maintainability The code follows the codebase's conventions and architecture. It reuses existing helpers instead of reinventing them. Nothing looks copied wholesale from another project, which could carry license obligations. There are no unnecessary abstractions, layers, or settings for a simple need. Names and comments explain intent. Comments don't just restate the code. A teammate could explain and change this in six months. 7. Performance and operations There are no N+1 queries, unbounded loops, or whole datasets loaded into memory. Network and database calls have timeouts, and retries have limits and backoff. List endpoints have pagination or limits. Nothing blocks the Node.js event loop, such as synchronous file reads or heavy CPU work. Logs are useful and free of sensitive data. Migrations are safe and reversible, and configuration comes from the environment. What to catch: an example Here's an endpoint that might come out of a quick prompt. It works, and a manual test would pass: app.get(\"/users/:id/orders\", async (req, res) =&gt; { const { rows } = await db.query( `SELECT * FROM orders WHERE user_id = '${req.params.id}'` ); res.json(rows); });It has several problems: SQL injection. The ID is interpolated straight into the query. Broken access control. There's no authentication or ownership check, so any caller can read anyone's orders. Over-exposure. SELECT * returns every column, including internal ones. Missing error handling. In Express 4, a failed query in an async handler never reaches your error handler, and the request hangs. Express 5 forwards the error for you, so check which version you're on. Here's a safer version: app.get(\"/users/:id/orders\", requireAuth, async (req, res, next) =&gt; { try { // ids are UUID strings in this example if (req.user.id !== req.params.id &amp;&amp; !req.user.isAdmin) { return res.status(403).json({ error: \"Forbidden\" }); } const { rows } = await db.query( \"SELECT id, status, total, created_at FROM orders WHERE user_id = $1\", [req.params.id] ); res.json(rows); } catch (err) { next(err); } });Nothing in the first version would fail a happy-path test. That's the pattern to look for: code that behaves correctly for the expected input and badly for everything else. Tests deserve the same suspicion. AI-written tests often repeat the implementation, so they can only ever agree with it: // Weak: the test re-implements the logic it is checking test(\"applies a discount\", () =&gt; { const price = 100; expect(applyDiscount(price, 0.25)).toBe(price - price * 0.25); }); // Better: concrete expected values, including edge cases test.each([ [100, 0.25, 75], [100, 0, 100], [0, 0.5, 0], ])(\"applyDiscount(%d, %d) returns %d\", (price, rate, expected) =&gt; { expect(applyDiscount(price, rate)).toBe(expected); });If the implementation and the test share the same mistake, the test still passes. Review techniques that work Read the tests first. They show what the author believes the code does. Review in layers. Start with whether it's the right problem and the right design. Then check the logic. Leave style for last. Run it. Check out the branch and try bad input. Reading alone misses things. Ask the author to explain. If they can't explain a block, it isn't ready. \"Why this approach?\" is a fair question. Break it on purpose. Flip a condition or remove a check and see whether a test fails. Watch your own fatigue. Long AI-generated diffs invite rubber-stamping. If a change is too big to review properly, say so and ask for it to be split. Use AI as a first pass, not the last. An AI reviewer can catch typos and missing null checks, but it shares blind spots with the model that wrote the code and doesn't know your context. A human makes the call. Red flags at a glance Some signs deserve a closer look before you read a single line: A large diff for a small task Files changed that the ticket never mentioned Tests changed or removed in the same PR as the code they cover A new dependency for something trivial catch blocks that swallow errors Hardcoded values that match the test data Placeholder comments such as \"implement later\" Code in a different style from the rest of the file Make it easy: a PR template A template turns the checklist into a habit. Here's a short one to start from: ## AI assistance - [ ] No AI used - [ ] AI used (tool: ______). What I asked it to do: ______ ## Author checklist - [ ] I read every line of this diff and can explain it - [ ] I ran it locally and tried edge cases and bad input - [ ] Tests fail when I break the behavior they cover - [ ] New dependencies are verified (exist, maintained, licensed, needed) - [ ] No secrets or customer data in code, logs, or prompts - [ ] No unrelated changesTeam policies that help Require CI to pass before human review starts. Linting, type checks, tests, dependency audits, and security scans should all be in the pipeline. Use code owners for sensitive paths. On GitHub, a CODEOWNERS file plus branch protection can require approval from the owners of the files a pull request touches. Agree on extra-scrutiny areas. Authentication, payments, cryptography, migrations, and infrastructure changes deserve a second pair of eyes. Set a rule for prompts. Don't paste secrets or customer data into AI tools. Learn from misses. When an AI-written bug reaches production, add the lesson to the checklist. Key takeaways Treat AI-generated code as untrusted input: read it, run it, and test it before it merges. The author owns the change, no matter who or what wrote it. Watch for hallucinated APIs and packages, missing authorization, weak tests, and unrelated edits. Keep pull requests small and automate everything a machine can check. Use AI as a first-pass reviewer if you like, but keep a human accountable for the final decision. A short, shared checklist in the PR template beats an unwritten set of expectations. Further reading Google Engineering Practices, Code Review Developer Guide. A widely used description of what reviewers should look for, including design, functionality, tests, and complexity. Spracklen et al., \"We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMs\". The study behind the package hallucination figures above. Veracode, 2025 GenAI Code Security Report announcement, and TechRadar's coverage of the October 2026 update. OWASP, Top 10 Web Application Security Risks. A starting point for the security items in the checklist. GitHub docs, About code owners. How to require review from the people who own sensitive code.","contentHash":"sha256:b262ce8512e9e710a2ed3d3582119147a87c82015c3a6028adcade51338ff7df","authorName":"Shobit Singh","authorUrl":"https://zyvop.com/author/shobit","authorSameAs":[],"category":"Programming","tags":["security","team workflow","AI coding","software quality","code-review"],"audience":"Software engineers and developers building applications with Programming","tone":"Instructional, practical, code-first","readingTimeMinutes":8,"wordCount":2066,"faqs":null,"primaryTopic":"Programming","publishedAt":"2026-11-20T08:48:39.011Z","updatedAt":"2026-11-20T08:48:39.011Z","canonicalUrl":"https://zyvop.com/how-to-review-ai-generated-code-a-checklist-for-teams-wkwyj"}