When NOT to use
- Trivial formatting/linter-only diff — tooling already enforces; skip review.
- No diff to pin (nothing changed).
Code Review
Default to Branch A. Three branches:
- Branch A — Five-factor review (default)
- Branch B — Request review: dispatch a reviewer subagent
- Branch C — Receive review: evaluate feedback
Branch A — Five-factor review
- Pin the diff — default
git diff origin/main...HEAD.
- Load conditioned references — SQL diff →
references/sql-review.md, Python diff → references/python-standards.md.
- Find the spec if any, then check each factor below.
At the end, present findings per factor with one summary line for the worst issue per factor. Then add one overall
CRITICAL line at top if any factor has a security/correctness blocker that should outrank style — do not merge non-critical factors.
1. Code Conventions
Code follows project style and avoids known smells.
- ☐ Documented convention violations (cite file + rule)
- ☐ Baseline smells: Mysterious Name, Duplicated Code, Feature Envy, Data Clumps, Primitive Obsession, Repeated Switches, Shotgun Surgery, Divergent Change, Speculative Generality, Message Chains, Middle Man, Refused Bequest
- ☐ SQL diff → check injection (CRITICAL), anti-patterns, performance
- ☐ Python diff → check correctness, type-safety, performance, style
- ☐ Skip what tooling already enforces; documented standards override baseline
2. Spec Alignment
Change matches requirements without scope creep.
- ☐ Requirements missing or partial
- ☐ Behaviour not asked for (scope creep)
- ☐ Implementation that looks wrong (quote spec)
- ☐ No spec available → skip this factor
3. Correctness
Logic is sound; edge cases handled.
- ☐ Off-by-one and boundary errors in ranges
- ☐ Unhandled error paths or silent failures
- ☐ Wrong data types or implicit casts that lose precision
- ☐ Race conditions or shared-mutation bugs
4. Maintainability
Code is simple, minimal, and sustainable. Be ambitious — flag deep restructuring that simplifies the codebase.
- ☐ Code-judo: delete branches or layers rather than modify
- ☐ Deletion test: each new module or abstraction earns its keep
- ☐ Shallow module, locality (scattered files), file crosses 1000 lines, new conditionals in unrelated paths
- ☐ Wrappers/casts/optionals hiding a simpler boundary; feature logic leaking into the wrong layer
- ☐ AI slop: verbose comments, defensive bloat, broad
except Exception, unnecessary casts
- ☐ Structural concerns → load
references/maintainability-review.md for the deep standards. Report restructuring findings — do not implement.
- ☐ Diff is the smallest working change
5. Security & Performance
No vulnerabilities or regressions.
- ☐ Secrets exposed in diff
- ☐ SQL injection or command injection vectors
- ☐ Missing input validation
- ☐ Unnecessary allocations, N+1 queries, loop-invariant work
- ☐ Missing caching on repeated expensive operations
Branch B — Request review
Use when the user says "request review", "review before merge", or "have someone review this".
- Pin SHAs:
BASE_SHA=$(git merge-base origin/main HEAD), HEAD_SHA=$(git rev-parse HEAD).
- Dispatch a reviewer subagent via
Task (general) using references/code-reviewer.md. Fill {DESCRIPTION}, {PLAN_OR_REQUIREMENTS}, {BASE_SHA}, {HEAD_SHA}.
- Act on feedback: fix Critical immediately, Important before proceeding, note Minor, push back with reasoning if wrong.
Run before every merge. Also valuable when stuck, before refactoring, or after a complex bug fix.
Branch C — Receive review
Use when the user pastes review feedback or says "address feedback".
Core principle: verify before implementing.
Process:
- Read all feedback without reacting.
- Restate each item in your own words; clarify unclear items first.
- Verify against the codebase before changing anything.
- Push back if the suggestion is wrong for this codebase or conflicts with prior decisions.
- Implement one item at a time; test each. Order: blocking issues, simple fixes, complex fixes.
Rules:
- No performative agreement ("You're absolutely right", "Great point").
- Check YAGNI for "implement properly" suggestions: if the code isn't used, propose removal.
- Reply to inline comments in the inline thread, not as a top-level comment.
Completion criteria
Related skills
systematic-debugging — root cause before review fix.
refactor — structural concerns flagged, not implemented.
triage — PR as issue-with-code.
1---2name: code-review3description: Use when reviewing code — diffs, PRs, branches, WIP, or SQL — or when requesting or responding to code review.4---56## When NOT to use78- Trivial formatting/linter-only diff — tooling already enforces; skip review.9- No diff to pin (nothing changed).1011# Code Review1213Default to Branch A. Three branches:1415- **Branch A — Five-factor review** (default)16- **Branch B — Request review**: dispatch a reviewer subagent17- **Branch C — Receive review**: evaluate feedback1819## Branch A — Five-factor review20211. **Pin the diff** — default `git diff origin/main...HEAD`.222. **Load conditioned references** — SQL diff → `references/sql-review.md`, Python diff → `references/python-standards.md`.233. **Find the spec** if any, then check each factor below.24At the end, present findings per factor with one summary line for the worst issue per factor. Then add one overall `CRITICAL` line at top if any factor has a security/correctness blocker that should outrank style — do not merge non-critical factors.2526### 1. Code Conventions27Code follows project style and avoids known smells.28- ☐ Documented convention violations (cite file + rule)29- ☐ Baseline smells: Mysterious Name, Duplicated Code, Feature Envy, Data Clumps, Primitive Obsession, Repeated Switches, Shotgun Surgery, Divergent Change, Speculative Generality, Message Chains, Middle Man, Refused Bequest30- ☐ SQL diff → check injection (CRITICAL), anti-patterns, performance31- ☐ Python diff → check correctness, type-safety, performance, style32- ☐ Skip what tooling already enforces; documented standards override baseline3334### 2. Spec Alignment35Change matches requirements without scope creep.36- ☐ Requirements missing or partial37- ☐ Behaviour not asked for (scope creep)38- ☐ Implementation that looks wrong (quote spec)39- ☐ No spec available → skip this factor4041### 3. Correctness42Logic is sound; edge cases handled.43- ☐ Off-by-one and boundary errors in ranges44- ☐ Unhandled error paths or silent failures45- ☐ Wrong data types or implicit casts that lose precision46- ☐ Race conditions or shared-mutation bugs4748### 4. Maintainability49Code is simple, minimal, and sustainable. Be ambitious — flag deep restructuring that simplifies the codebase.50- ☐ Code-judo: delete branches or layers rather than modify51- ☐ Deletion test: each new module or abstraction earns its keep52- ☐ Shallow module, locality (scattered files), file crosses 1000 lines, new conditionals in unrelated paths53- ☐ Wrappers/casts/optionals hiding a simpler boundary; feature logic leaking into the wrong layer54- ☐ AI slop: verbose comments, defensive bloat, broad `except Exception`, unnecessary casts55- ☐ Structural concerns → load `references/maintainability-review.md` for the deep standards. Report restructuring findings — do not implement.56- ☐ Diff is the smallest working change5758### 5. Security & Performance59No vulnerabilities or regressions.60- ☐ Secrets exposed in diff61- ☐ SQL injection or command injection vectors62- ☐ Missing input validation63- ☐ Unnecessary allocations, N+1 queries, loop-invariant work64- ☐ Missing caching on repeated expensive operations6566## Branch B — Request review6768Use when the user says "request review", "review before merge", or "have someone review this".69701. **Pin SHAs:** `BASE_SHA=$(git merge-base origin/main HEAD)`, `HEAD_SHA=$(git rev-parse HEAD)`.712. **Dispatch a reviewer subagent** via `Task` (`general`) using `references/code-reviewer.md`. Fill `{DESCRIPTION}`, `{PLAN_OR_REQUIREMENTS}`, `{BASE_SHA}`, `{HEAD_SHA}`.723. **Act on feedback:** fix Critical immediately, Important before proceeding, note Minor, push back with reasoning if wrong.7374Run before every merge. Also valuable when stuck, before refactoring, or after a complex bug fix.7576## Branch C — Receive review7778Use when the user pastes review feedback or says "address feedback".7980**Core principle:** verify before implementing.8182**Process:**83841. Read all feedback without reacting.852. Restate each item in your own words; clarify unclear items first.863. Verify against the codebase before changing anything.874. Push back if the suggestion is wrong for this codebase or conflicts with prior decisions.885. Implement one item at a time; test each. Order: blocking issues, simple fixes, complex fixes.8990**Rules:**9192- No performative agreement ("You're absolutely right", "Great point").93- Check YAGNI for "implement properly" suggestions: if the code isn't used, propose removal.94- Reply to inline comments in the inline thread, not as a top-level comment.9596## Completion criteria9798- [ ] Diff pinned (`origin/main...HEAD` or explicit SHAs) and conditioned references loaded99- [ ] Findings reported per factor with worst-issue summary; no cross-factor reranking100- [ ] Branch B/C: reviewer dispatched or feedback triaged item-by-item with verification101102## Related skills103104- `systematic-debugging` — root cause before review fix.105- `refactor` — structural concerns flagged, not implemented.106- `triage` — PR as issue-with-code.