Skip to content

The AI Code Review Checklist Every Team Needs

A battle-tested checklist for reviewing AI-generated PRs, organized by priority. Every item caught a real bug in a real codebase. Print it, pin it, use it.

6 min read
Illustrative shallow compartmented inspection tray with matching pairs of small metal components and their corresponding unmarked shape gauges.
On this page

I've reviewed over 500 AI-assisted PRs in the past year. Every team I've worked with asked for the same thing: a concrete checklist they can pin to their monitors and use during code review. This is that checklist.

It's not theoretical. Every item on this list caught a real bug or quality issue in a real codebase. I've organized it by category and priority, so you can adapt it to your team's specific needs.

How to Use This Checklist

Don't try to check every item on every PR. That defeats the purpose. Instead:

  1. Always check the Critical items (they catch the highest-impact bugs)
  2. Check Architecture items when the PR adds new files or patterns
  3. Check Performance items when the PR touches data fetching, loops, or database queries
  4. Check Testing items when the PR includes test files

Time target: 10-15 minutes per PR using this checklist. The AI code quality guide places review alongside prompting, automated checks and runtime monitoring.

Select checks for the proposed changeCriticalArchitecturePerformanceTesting
Figure 1. Run the critical checks and select the additional checks that the changed behavior needs.

The Checklist

Critical (Check Every PR)

markdown
## Critical Security & Correctness
- [ ] No hardcoded secrets, API keys, or credentials
- [ ] Authentication check present on all protected endpoints
- [ ] Authorization check present (not just authentication)
- [ ] User input validated and sanitized before use
- [ ] No SQL/NoSQL injection vectors (parameterized queries only)
- [ ] Error responses don't leak internal details (stack traces, DB schema)
- [ ] Sensitive data not logged (passwords, tokens, PII)

These seven items catch the most dangerous AI mistakes. AI regularly generates code that skips auth checks, logs sensitive data, or uses string interpolation in database queries. I've seen each of these in production codebases.

Example catch: AI generated an API endpoint that checked if the user was logged in but didn't check if they had permission to access the specific resource. Classic IDOR vulnerability. Resource-level authorization checks the caller’s permission for the invoice being requested.[1]

Access to the requested invoiceUser logged inPermission forthis invoiceReturn invoice
Figure 2. An authenticated caller still needs permission for the particular resource.
typescript
// AI generated (vulnerable)
app.get("/api/invoices/:id", requireAuth, async (req, res) => {
  const invoice = await prisma.invoice.findUnique({
    where: { id: req.params.id },
  });
  return res.json(invoice);
});

// Fixed (checks ownership)
app.get("/api/invoices/:id", requireAuth, async (req, res) => {
  const invoice = await prisma.invoice.findUnique({
    where: { id: req.params.id, userId: req.user.id },
  });
  if (!invoice) return res.status(404).json({ error: "Not found" });
  return res.json(invoice);
});

Architecture (Check When Adding New Files/Patterns)

markdown
## Architecture & Patterns
- [ ] Follows existing project error handling pattern
- [ ] Uses established data access layer (not direct DB calls in routes)
- [ ] Imports use project aliases (@/) not deep relative paths
- [ ] No new dependencies added without team approval
- [ ] File placed in correct directory per project structure
- [ ] No duplicate logic (search codebase for similar functions)
- [ ] Follows existing naming conventions (files, variables, functions)
- [ ] Uses existing shared utilities instead of reimplementing

The "no duplicate logic" check is crucial. An assistant can miss formatCurrency() in your utils folder when it retrieves incomplete repository context. Search for an existing helper before accepting another implementation. I once found 11 implementations of email validation in a single codebase, each slightly different.[2]

Edge Cases (Check When Touching Business Logic)

markdown
## Edge Cases & Error Handling
- [ ] Null/undefined inputs handled explicitly
- [ ] Empty arrays and empty strings considered
- [ ] Boundary conditions tested (exactly at limit, one above, one below)
- [ ] Network failure handling present (timeouts, retries, fallbacks)
- [ ] Concurrent access considered (race conditions, double submissions)
- [ ] Errors propagated correctly (not swallowed with console.log)
- [ ] Partial failure scenarios handled (what if step 2 of 3 fails?)

Performance (Check When Touching Data Layer)

markdown
## Performance
- [ ] No N+1 query patterns (use include/join instead of loops)
- [ ] Database queries use appropriate indexes
- [ ] Large datasets paginated (no unbounded findMany/SELECT *)
- [ ] Promise.all used for independent async operations
- [ ] No blocking operations in request handlers
- [ ] Response payload size reasonable (no over-fetching)

An N+1 pattern issues an additional query for each result in a collection:[3]

typescript
// AI loves this pattern (N+1 queries)
const users = await prisma.user.findMany();
const usersWithPosts = await Promise.all(
  users.map(async (user) => ({
    ...user,
    posts: await prisma.post.findMany({ where: { authorId: user.id } }),
  }))
);

// Fetch the related records without a separate query per user.
// SQL query count depends on the configured relation load strategy.
const usersWithPosts = await prisma.user.findMany({
  include: { posts: true },
});

Testing (Check When PR Includes Tests)

markdown
## Test Quality
- [ ] Tests verify behavior, not implementation details
- [ ] Edge cases from above have corresponding tests
- [ ] Error/failure paths tested (not just happy path)
- [ ] Mocks are minimal (only external dependencies mocked)
- [ ] Assertions are specific (not just "toBeDefined")
- [ ] Test descriptions clearly state expected behavior
- [ ] No tests that mirror the implementation logic

The Quick-Reference Card

Print this and keep it next to your monitor:

AI CODE REVIEW QUICK CHECK
===========================
1. Auth + AuthZ present?
2. Input validated?
3. Follows our patterns?
4. Duplicate logic?
5. Edge cases handled?
6. Errors propagated?
7. N+1 queries?
8. Tests verify behavior?
===========================
If any "no": request changes.

Integrating the Checklist Into Your Workflow

Option 1: PR Template

Add the checklist to your GitHub PR template so every reviewer sees it:[4]

markdown
<!-- .github/pull_request_template.md -->
## AI Code Review Checklist
(Check items you've verified. Leave unchecked items with a note.)

- [ ] No hardcoded secrets or credentials
- [ ] Auth and authorization checks present
- [ ] Follows existing codebase patterns
- [ ] Edge cases handled
- [ ] Tests verify behavior, not implementation

Option 2: Automated Checks

Automate what you can. The CI/CD quality gate guide develops that part of the workflow. Project-specific static rules can detect selected code patterns. ESLint and Semgrep rules need tests, and their coverage depends on the syntax and data flow they inspect. Save human review time for the things that require judgment.[5]

Option 3: Review Rotation

Assign an "AI quality reviewer" each sprint. This person does a deep review of all AI-assisted PRs using the full checklist. Other reviewers use the quick-reference card. The AI review process guide covers how to divide the work between reviewers.

What I Got Wrong

I originally made this checklist 30 items long. Nobody used it because it took too long. The version above is the result of cutting it down to the items that actually caught bugs. Every item I removed was either too rare to justify the review time or better caught by automated tooling.

The lesson: a checklist that gets used at 80% thoroughness beats a perfect checklist that gets skipped.

Start with the Critical section and record the issues it catches in your own review process. Add sections as the habit builds.

Keep the review reference independent

In MachGTM, which I build, reviewing a generated research brief raises an evidence question that also applies to AI-assisted code. The research-quality account describes defining the expected facts independently, retaining their supporting passages, and recording missing findings separately from unsupported claims. For a pull request, declare the required behaviours and failure cases before reading the generated tests, then keep the observed results and unresolved cases with the review.

Frequently asked questions

Should every pull request use the whole checklist?

Start with the critical security and correctness checks on each change. Add architecture checks for new patterns, performance checks for data access and testing checks for changed behavior. A focused review is easier to repeat than a checklist applied mechanically.

Why is authentication insufficient for an invoice endpoint?

Authentication identifies the caller. The endpoint must also verify that this caller can access the particular invoice. Scope the data lookup or apply an equivalent resource-level permission check before returning the record.

Does Prisma include always execute one SQL query?

The relation load strategy affects the SQL Prisma sends. A nested read can use multiple SQL queries while avoiding a separate query for every user. Inspect query behavior in the version and configuration your project actually uses.

Which checklist items can be automated?

Linters, security scans, dependency checks and project-specific static rules can cover repeatable patterns. They need tests and suitable scope. Business requirements, unusual failure paths and the wider effect of a change still need an engineer’s review.

Sources

  1. [1]OWASP API Security Project | OWASP Foundation · OWASP Foundation
  2. [2]Indexing repositories for GitHub Copilot - GitHub Docs · GitHub Docs
  3. [3]Query optimization (Prisma ORM v7) · Prisma
  4. [4]Creating a pull request template for your repository - GitHub Docs · GitHub Docs
  5. [5]Write rules - Semgrep · Semgrep

Checked against these sources on

Related Articles