Code Review
Intro
Code review is a structured pass over a diff against a fixed
checklist, then a categorized response: must-fix, should-fix, nit.
The goal is to surface real defects with specific line references,
not to rewrite the author's code.
Overview
The review checklist
Read the diff or changed files, then evaluate each change against:
- Correctness — Does the code do what it claims? Are edge
cases handled?
- Clarity — Are names descriptive? Is the logic easy to
follow on a single read?
- Tests — Are new behaviors tested? Do existing tests still
hold?
- Security — Hardcoded secrets, SQL injection, unsafe input
handling, missing authz?
- Performance — Unnecessary allocations, N+1 queries,
accidental O(n^2) loops?
- Style — Consistent with the project's existing conventions
(not your personal preferences)?
Categorize findings
Sort each finding into one bucket and label it explicitly:
- Must fix — bugs, security issues, broken tests, contract
violations
- Should fix — unclear naming, missing tests for non-trivial
paths, code smells
- Nit — style preferences, minor suggestions, taste calls
Always include specific line references and concrete suggestions.
Acknowledge what was done well — review is not adversarial.
Gotchas
Agent-specific failure modes — provider-neutral pause-and-self-check items:
- Burying must-fix items after style comments. When a security issue or correctness bug appears three paragraphs into a review, the author may miss it. Lead with must-fix items; put nits at the end.
- Vague comments without line references or concrete suggestions. "This looks weird" is not actionable. Every finding needs a specific line reference and a concrete suggestion — what is the problem and what would fix it.
- Stamp-of-approval review. Skimming the diff and approving to move it along defeats the purpose of review and gives the team false confidence. If you cannot read the changed lines, say so and ask to review in a smaller chunk.
- Reviewing huge diffs in one pass. Large diffs cause reviewer fatigue and cause real issues to be missed. Either push back on PR scope or break the review into sessions (security first, then logic, then style).
- Missing the escalation trigger. Line-by-line comments on a diff that has fundamental design issues waste both sides' time. When the design is wrong, stop the line review and raise the design concern first.
- Rewriting in review. Proposing complete rewrites of code that works demotivates authors and overreaches the reviewer's role. Propose the improvement once; the author owns the code.
- No acknowledgment of what was done well. All-negative reviews are adversarial over time and reduce the quality of future work. Code review should also surface what was done right.
Full reference
Example output shape
Must fix: parse_input() on line 42 doesn't handle empty
strings — this will panic.
Should fix: The variable x on line 15 could be renamed to
retry_count for clarity.
Nit: Consider extracting lines 30-45 into a helper function.
Overall: Good separation of concerns. The error handling pattern
is clean.
Anti-patterns
- Rewriting in review — propose, don't dictate. The author
owns the code.
- Bikeshedding — if it's a nit, label it a nit and move on.
- Stamp-of-approval review — skimming and approving without
reading the changed lines defeats the purpose.
- Vague comments — "this looks weird" is not actionable. Say
what's weird and what would fix it.
- Reviewing in one pass when the diff is huge — split the
review across sessions or push back on PR scope.
When to escalate
If the diff has fundamental design issues, stop the line-by-line
review and discuss the design first. Line comments on a diff that
should never have been written waste both sides' time.
1---2name: code-review-23description: Structured code review with a checklist covering correctness, clarity, tests, security, performance, and style. Use when reviewing a PR, diff, or set of code changes before merging — including phrases like "review this", "check my changes", or "is this ready to merge".4---56# Code Review78## Intro910Code review is a structured pass over a diff against a fixed11checklist, then a categorized response: must-fix, should-fix, nit.12The goal is to surface real defects with specific line references,13not to rewrite the author's code.1415## Overview1617### The review checklist1819Read the diff or changed files, then evaluate each change against:2021- **Correctness** — Does the code do what it claims? Are edge22 cases handled?23- **Clarity** — Are names descriptive? Is the logic easy to24 follow on a single read?25- **Tests** — Are new behaviors tested? Do existing tests still26 hold?27- **Security** — Hardcoded secrets, SQL injection, unsafe input28 handling, missing authz?29- **Performance** — Unnecessary allocations, N+1 queries,30 accidental O(n^2) loops?31- **Style** — Consistent with the project's existing conventions32 (not your personal preferences)?3334### Categorize findings3536Sort each finding into one bucket and label it explicitly:3738- **Must fix** — bugs, security issues, broken tests, contract39 violations40- **Should fix** — unclear naming, missing tests for non-trivial41 paths, code smells42- **Nit** — style preferences, minor suggestions, taste calls4344Always include specific line references and concrete suggestions.45Acknowledge what was done well — review is not adversarial.4647## Gotchas4849Agent-specific failure modes — provider-neutral pause-and-self-check items:5051- **Burying must-fix items after style comments.** When a security issue or correctness bug appears three paragraphs into a review, the author may miss it. Lead with must-fix items; put nits at the end.52- **Vague comments without line references or concrete suggestions.** "This looks weird" is not actionable. Every finding needs a specific line reference and a concrete suggestion — what is the problem and what would fix it.53- **Stamp-of-approval review.** Skimming the diff and approving to move it along defeats the purpose of review and gives the team false confidence. If you cannot read the changed lines, say so and ask to review in a smaller chunk.54- **Reviewing huge diffs in one pass.** Large diffs cause reviewer fatigue and cause real issues to be missed. Either push back on PR scope or break the review into sessions (security first, then logic, then style).55- **Missing the escalation trigger.** Line-by-line comments on a diff that has fundamental design issues waste both sides' time. When the design is wrong, stop the line review and raise the design concern first.56- **Rewriting in review.** Proposing complete rewrites of code that works demotivates authors and overreaches the reviewer's role. Propose the improvement once; the author owns the code.57- **No acknowledgment of what was done well.** All-negative reviews are adversarial over time and reduce the quality of future work. Code review should also surface what was done right.5859## Full reference6061### Example output shape6263> **Must fix:** `parse_input()` on line 42 doesn't handle empty64> strings — this will panic.65>66> **Should fix:** The variable `x` on line 15 could be renamed to67> `retry_count` for clarity.68>69> **Nit:** Consider extracting lines 30-45 into a helper function.70>71> Overall: Good separation of concerns. The error handling pattern72> is clean.7374### Anti-patterns7576- **Rewriting in review** — propose, don't dictate. The author77 owns the code.78- **Bikeshedding** — if it's a nit, label it a nit and move on.79- **Stamp-of-approval review** — skimming and approving without80 reading the changed lines defeats the purpose.81- **Vague comments** — "this looks weird" is not actionable. Say82 what's weird and what would fix it.83- **Reviewing in one pass when the diff is huge** — split the84 review across sessions or push back on PR scope.8586### When to escalate8788If the diff has fundamental design issues, stop the line-by-line89review and discuss the design first. Line comments on a diff that90should never have been written waste both sides' time.