Code Review
Goal
Judge whether a change is correct, safe, and maintainable, and return specific
findings the author can act on. Verify the code itself rather than trusting the
description.
Core rule
Review what the diff actually does, not what the title or summary claims it
does. Confirm each claim against the code. Descriptions drift from
implementations.
Workflow
- Establish the change set and intent. Read the diff in full and the stated
purpose. Determine what behavior is meant to change and what must stay the
same.
- Confirm scope. Flag unrelated changes, drive-by edits, and generated or
vendored files mixed into the diff. A change that does more than it claims is
harder to review and to revert.
- Review against the axes below, in order of impact.
- Verify claims. Trace the code paths that the description says it changed.
Check that tests actually exercise the new behavior and would fail without
the change.
- Collect findings with exact
file:line locations, evidence, and a concrete
recommended correction.
- Rank by severity and separate blocking from non-blocking.
- Report the verdict, the findings, what you verified, and residual risk.
Review axes
Assess in this order; correctness first because it dominates.
- Correctness: Does it do what it intends across normal and boundary inputs? Look
for off-by-one, wrong conditionals, unhandled null or empty cases, incorrect
assumptions about ordering, and concurrency hazards.
- Tests: Do tests exist for the new behavior, assert observable outcomes, and
fail without the change? Look for missing edge and error cases and for tests
that assert nothing meaningful.
- Error and edge cases: Are failures handled or surfaced? Look for swallowed
errors, missing validation, and resources not released on the failure path.
- Security: Untrusted input reaching a sink, missing authorization checks,
injection, secrets in code or logs, and unsafe deserialization. See
references/review-checklist.md.
- Performance: Accidental quadratic loops, work inside hot paths, unbounded
growth, and N+1 access patterns. Flag only realistic impact, not speculation.
- Readability and maintainability: Unclear names, dead code, duplicated logic,
and functions doing too much. Comment only what affects correctness or intent.
- Architectural fit: Does the change respect existing boundaries, layering, and
conventions, or does it bypass them and add coupling?
What not to comment on
- Formatting, spacing, quote style, and import order handled by an automatic
formatter or linter. Let the tool own these.
- Personal style preferences with no correctness or clarity impact.
- Rewrites of code the change did not touch, unless directly relevant.
Severity ranking
- Critical: a defect that causes incorrect behavior, data loss, or a security
hole. Blocking.
- Required: a real problem that must be fixed before merge, such as a missing
test for new logic or an unhandled error path. Blocking.
- Optional: an improvement that is not a defect. Non-blocking; label it as such.
State each finding as file:line — the problem, its impact, and the fix.
Output
Report a verdict of approve, request changes, or block. Then list findings under
Critical, Required, and Optional headings. Then state what you verified, such as
commands run or code paths traced, and any residual risk you could not confirm.
References
- references/review-checklist.md — per-axis
checks for correctness, tests, error handling, security, performance,
readability, and architecture.
1---2name: code-review3description: Reviews a diff, pull request, or set of staged changes for correctness, tests, error and edge cases, security, performance, readability, and architectural fit, then reports severity-ranked, actionable findings with file and line references. Use when reviewing a PR, examining staged or unstaged changes, giving feedback on a patch, or deciding whether a change is safe to merge.4license: MIT5---67# Code Review89## Goal1011Judge whether a change is correct, safe, and maintainable, and return specific12findings the author can act on. Verify the code itself rather than trusting the13description.1415## Core rule1617Review what the diff actually does, not what the title or summary claims it18does. Confirm each claim against the code. Descriptions drift from19implementations.2021## Workflow22231. Establish the change set and intent. Read the diff in full and the stated24 purpose. Determine what behavior is meant to change and what must stay the25 same.262. Confirm scope. Flag unrelated changes, drive-by edits, and generated or27 vendored files mixed into the diff. A change that does more than it claims is28 harder to review and to revert.293. Review against the axes below, in order of impact.304. Verify claims. Trace the code paths that the description says it changed.31 Check that tests actually exercise the new behavior and would fail without32 the change.335. Collect findings with exact `file:line` locations, evidence, and a concrete34 recommended correction.356. Rank by severity and separate blocking from non-blocking.367. Report the verdict, the findings, what you verified, and residual risk.3738## Review axes3940Assess in this order; correctness first because it dominates.41421. Correctness: Does it do what it intends across normal and boundary inputs? Look43 for off-by-one, wrong conditionals, unhandled null or empty cases, incorrect44 assumptions about ordering, and concurrency hazards.452. Tests: Do tests exist for the new behavior, assert observable outcomes, and46 fail without the change? Look for missing edge and error cases and for tests47 that assert nothing meaningful.483. Error and edge cases: Are failures handled or surfaced? Look for swallowed49 errors, missing validation, and resources not released on the failure path.504. Security: Untrusted input reaching a sink, missing authorization checks,51 injection, secrets in code or logs, and unsafe deserialization. See52 [references/review-checklist.md](references/review-checklist.md).535. Performance: Accidental quadratic loops, work inside hot paths, unbounded54 growth, and N+1 access patterns. Flag only realistic impact, not speculation.556. Readability and maintainability: Unclear names, dead code, duplicated logic,56 and functions doing too much. Comment only what affects correctness or intent.577. Architectural fit: Does the change respect existing boundaries, layering, and58 conventions, or does it bypass them and add coupling?5960## What not to comment on6162- Formatting, spacing, quote style, and import order handled by an automatic63 formatter or linter. Let the tool own these.64- Personal style preferences with no correctness or clarity impact.65- Rewrites of code the change did not touch, unless directly relevant.6667## Severity ranking6869- Critical: a defect that causes incorrect behavior, data loss, or a security70 hole. Blocking.71- Required: a real problem that must be fixed before merge, such as a missing72 test for new logic or an unhandled error path. Blocking.73- Optional: an improvement that is not a defect. Non-blocking; label it as such.7475State each finding as `file:line` — the problem, its impact, and the fix.7677## Output7879Report a verdict of approve, request changes, or block. Then list findings under80Critical, Required, and Optional headings. Then state what you verified, such as81commands run or code paths traced, and any residual risk you could not confirm.8283## References8485- [references/review-checklist.md](references/review-checklist.md) — per-axis86 checks for correctness, tests, error handling, security, performance,87 readability, and architecture.