Skip to Content
Mengty Learns
Process

Practical Code Review (Including AI-Generated Code)

What to review (correctness, security, tests, readability), PR sizing, Conventional Comments, turnaround targets, self-review, and verifying AI-generated PRs.

how-tobeginnerTested with conventional_comments 1.0.0Updated Nov 27, 2026

TL;DR

Review for correctness, security, tests, and readability—never for style that eslint or prettier can fix. Keep PRs small, label comments with Conventional Comments (issue:, nitpick:, suggestion:), and when reviewing AI-generated code, always verify claims, run the suite, and check git log.

1. What to review (and what to skip)

Focus here (Human judgment)Skip here (Automate in CI)
Does this solve the stated problem and edge cases?Semicolons, quotes, indentation, import sorting
Trust boundaries: authZ, input validation, secrets, XSS/SQLiUnused variables or missing types (eslint / tsc)
Do tests assert real behavior (not just mock tautologies)?Dead formatting preferences
Can a teammate understand this function in 6 months?Bikeshedding over equivalent syntax

2. PR size and turnaround

  • PR size: Aim for ≤ 200–400 lines changed (excluding lockfiles or generated snapshots). Separate mechanical refactors from behavior changes into two PRs.
  • Review turnaround: Target < 24 hours (ideally within a few hours). Unblocking a teammate's PR has higher leverage than starting a new feature of your own.

3. Conventional Comments

Prefix review comments so the author immediately knows severity and intent:

issue (blocking): `deleteItem` checks authentication but not ownership (BOLA).
suggestion (non-blocking): Extract `parseFrontmatter` into a shared helper.
nitpick (non-blocking): Rename `d` to `durationMs` for clarity.
question: Does this endpoint need rate limiting before we ship?
praise: Clean separation between the pure layout function and React state!

Using (non-blocking) lets you approve the PR in the same pass instead of forcing another round-trip over a minor rename.

4. Reviewing AI-generated code

AI coding agents write plausible code fast—and can also hallucinate APIs, skip edge cases, or report stale test results. Apply these four checks on every agent PR:

  1. Verify claims against files: If the agent cites a symbol, flag, or library version, check node_modules or the actual file—never accept "I verified it" on faith.
  2. Run it yourself: Run pnpm lint && pnpm typecheck && pnpm test && pnpm build (or inspect CI logs) after the agent's final edit.
  3. Check git log and git status: Confirm commits actually exist on the branch, follow commit conventions, and contain no stray scratch files or trailers.
  4. Watch for duplication: Agents often reimplement an existing helper instead of reusing what's already in lib/ or components/.

5. Self-review checklist (before requesting review)

Even as a solo developer, review your own PR diff on GitHub/Git before merging:

  • Read every changed line in git diff—remove debug logs, unused imports, and unrelated edits.
  • Confirm new functions handle empty/null/error inputs.
  • Confirm tests would actually fail if the bug returned.
  • Write a 3-line PR summary: What changed, Why, and How it was verified.

Minimum viable version (1–3 person team + AI agents)

  • Solo developer: Treat every PR as an async self-review—never push directly to main for non-trivial changes; open a PR, let CI run, read the diff once with fresh eyes, then merge.
  • 2–3 person team: 1 approving review per PR, Conventional Comments prefixes, and a 4-hour daytime review SLA.

When it's overkill

  • Requiring 2+ senior approvals on a 1-line typo fix or dependency patch when CI is green.
  • Leaving 25 nitpick: comments on an urgent hotfix during a production incident.

Gotchas

  • Rubber-stamping 1,500-line PRs: Nobody actually reads a 1,500-line diff; reviewers say "LGTM" out of fatigue. Split the work earlier.
  • Treating style preferences as blocking: Blocking a PR over for..of vs .map() slows the team down and breeds resentment.

Production checklist

  • Automated lint/formatting runs in CI so reviews stay focused on logic and security.
  • PRs are small enough to review in 15–20 minutes.
  • Reviewers use explicit blocking vs non-blocking labels (Conventional Comments).
  • AI-generated diffs are verified by running tests and inspecting git log / git diff.

Check yourself

Check Yourself

1. You spot a missing ownership check in an API handler AND a slightly awkward local variable name. How should you write those two comments using Conventional Comments?

2. An AI coding agent finishes a task and says 'All tests pass.' What should the reviewer still do?

Sources