Hard Rules
- Scope is the diff only — review only what changed (
git diff or git diff --staged). Never audit the entire codebase; that is a full security audit, not a code review.
- Diff >1000 lines: STOP and ask the user to break it into logical chunks before reviewing.
- Do not request architecture changes in a code review — that belongs to a design/architecture pass.
- Do not request refactoring for code NOT in the diff — stay in scope.
- Do not flag style issues if there is a linter/formatter configured — trust the tooling.
Code Review Session
Review changed code systematically. Produce a severity-ranked finding list. Ship confidently.
Diff Size Check:
If the diff is >1000 lines, STOP and ask the user to break the review into logical chunks.
Large diffs cause reviewers to miss critical issues — smaller reviews are higher quality.
Scope: Review only what changed — git diff or git diff --staged. Never audit the entire codebase; that is a full security audit.
Review Checklist (in priority order)
Work top to bottom. Stop and fix before moving down.
CRITICAL — Block commit
HIGH — Fix before merging
MEDIUM — Fix if quick, log if not
LOW — Note and move on
How to Run
- Get the diff:
git diff # unstaged changes
git diff --staged # staged changes
git diff HEAD~1 # last commit
Go through checklist top-down. Don't spend time on LOW if CRITICAL exists.
File each finding with this format:
[SEVERITY] path/to/file.py:42 — what's wrong → specific fix
- Adversarial Pass (Devil's Advocate):
After the checklist, flip your mindset. You are now an attacker trying to BREAK this code.
- "What input would crash this?" — pick 3 edge cases and mentally trace them
- "What assumption is wrong?" — list every implicit assumption, challenge each one
- "What happens under load/concurrency?" — race conditions, shared state, non-atomic ops
- "If I deleted the implementation but kept the tests, would tests still pass?" — mock integrity
- 60%+ of effort here should be DISCONFIRMATION, not confirmation. Ask "why X fails" not "why X works"
- If this pass finds something the checklist missed, promote it to the appropriate severity level
- Output a verdict:
- ✅ Ship — no CRITICAL or HIGH findings
- ⚠️ Fix first — HIGH findings present
- 🚫 Block — CRITICAL found
Output Format
Code Review — <feature or file name>
Reviewed: <git diff range>
CRITICAL (N)
- [CRITICAL] src/auth.py:15 — API key hardcoded → move to os.environ.get("API_KEY")
HIGH (N)
- [HIGH] src/api.js:88 — fetch() not awaited → add await
MEDIUM (N)
- [MEDIUM] src/utils.py:30 — magic number 86400 → extract as SECONDS_PER_DAY
LOW (N)
- [LOW] src/models.py:55 — missing docstring on public method
Verdict: ✅ Ship / ⚠️ Fix HIGH before merge / 🚫 Block
What NOT to Flag
- Style/formatting a linter handles → run the linter instead
- "I would have done it differently" preferences → only flag if correctness is affected
- Architectural concerns already decided → raise separately, don't block this review
- Test edge cases beyond the spec → nice to have, not a blocker
- Entire file quality when only reviewing a diff → stay scoped to what changed
- Do not request architecture changes in a code review — that belongs to a design/architecture pass
- Do not request refactoring for code NOT in the diff — stay in scope
- Do not flag style issues if there's a linter/formatter configured — trust the tooling
Quick Reference
| Situation |
Action |
| Found a CRITICAL |
Stop. Fix before anything else. |
| Found only MEDIUM/LOW |
Ship with notes — document as TODOs |
| Unsure if it's a bug |
Check with a failing test — if you can write one, it's a bug |
| Hard to review your own code |
Use the checklist sequentially — don't free-form |
| Reviewing a large diff |
Break it into logical chunks, review each separately |
Review the Review
Before presenting findings:
- Re-read your critique. Is each point actionable and specific, or vague?
- Did you miss anything by focusing too much on one area?
- Are you being performatively thorough (flagging non-issues to seem careful) or genuinely helpful?
- Would a senior engineer agree with your top 3 findings?
Strip any finding that doesn't pass these checks.
Architecture Step-Back
After reviewing individual code quality, zoom out:
- Does this change fit well with the existing architecture, or is it fighting it?
- If this pattern were extended to 10 similar cases, would the codebase be better or worse?
- Is there a simpler design that achieves the same goal?
These are LOW severity observations — note them and move on. But they compound into real architectural improvements over time.
Second Opinion
After completing the review, consider running an independent reviewer for a different model's perspective — many CLIs expose a one-shot review command (e.g. a review --uncommitted or review <diff> subcommand). A second model often catches what the first missed.
Skill Chain
| Stage |
Skill |
| Before (writing the code) |
tdd-workflow — tests first, then implementation |
| This skill |
code-review-session — review before committing |
| Next (committing) |
a git-workflow pass — conventional commit, right branch |
| If CRITICAL security found |
security-audit — full audit if secrets or injection risk |
| If CRITICAL bug found |
debug-session — diagnose root cause before fixing |
| After fix |
tdd-workflow — add regression test for the bug found |
| For deep adversarial scrutiny |
devil-advocate — stress-test the change against its own assumptions |
Trigger Conditions
Use this skill when:
- You just wrote or modified code and want a pre-commit / pre-merge check ("review this code", "check my code", "look at what I wrote", "code review").
- You finished a feature or bug fix, or completed a tdd-workflow green phase.
- You are about to
git commit a non-trivial change.
Do NOT use it for design reviews, architecture discussions, or whole-codebase audits — this skill reviews a diff, not a system.
Out of Scope
- NOT for full codebase security audits — use
security-audit instead
- NOT for diagnosing root cause of a bug — use
debug-session instead
- NOT for architectural planning or design decisions — use
spec-driven-dev or decision-log instead
- NEVER use this for reviewing an entire repo — scope to the diff only
Common Traps
- Reviewing code you haven't read: Always read the file before commenting — reviewing a diff without understanding the surrounding code leads to incorrect or irrelevant suggestions.
- Suggesting changes that conflict with project rules: Check the project's own conventions and rules files first — the project may have hard rules that override general best practices.
- Over-reviewing trivial changes (formatting, style) instead of logic/architecture: Focus on substance — if a linter handles it, don't flag it. Spend review time on correctness, security, and design.
1---2name: code-review-session3description: Use after writing or modifying code, before committing or merging — to catch bugs, security issues, and quality problems. Trigger on: "review this code", "check my code", "look at what I wrote", "code review", finishing a feature or bug fix, after a tdd-workflow green phase, or before any git commit on non-trivial changes. NOT for design reviews, architecture discussions, or general issue checking — only for reviewing code changes (git diff).4license: MIT5---67## Hard Rules89- **Scope is the diff only** — review only what changed (`git diff` or `git diff --staged`). Never audit the entire codebase; that is a full security audit, not a code review.10- **Diff >1000 lines**: STOP and ask the user to break it into logical chunks before reviewing.11- Do not request architecture changes in a code review — that belongs to a design/architecture pass.12- Do not request refactoring for code NOT in the diff — stay in scope.13- Do not flag style issues if there is a linter/formatter configured — trust the tooling.1415# Code Review Session1617Review changed code systematically. Produce a severity-ranked finding list. Ship confidently.1819**Diff Size Check:**20If the diff is >1000 lines, STOP and ask the user to break the review into logical chunks.21Large diffs cause reviewers to miss critical issues — smaller reviews are higher quality.2223**Scope:** Review only what changed — `git diff` or `git diff --staged`. Never audit the entire codebase; that is a full security audit.2425---2627## Review Checklist (in priority order)2829Work top to bottom. Stop and fix before moving down.3031### CRITICAL — Block commit32- [ ] **Secrets exposed:** API keys, passwords, tokens hardcoded in source code33- [ ] **Data loss:** destructive operations (DELETE, DROP, overwrite) without guard34- [ ] **Provably wrong logic:** off-by-one, inverted condition, wrong operator35- [ ] **Security hole:** unvalidated user input at a boundary, SQL injection, XSS36- [ ] **New code has zero test coverage** (unless it's configuration/markup only)3738### HIGH — Fix before merging39- [ ] **Exceptions swallowed:** `except: pass`, `.catch(() => {})`, silent error discard40- [ ] **Null/undefined unguarded:** accessing `.property` on something that could be None/null41- [ ] **Breaking change:** function signature changed, callers not updated42- [ ] **Performance trap:** O(n²) in hot path, N+1 queries, blocking the event loop43- [ ] **Zero test coverage on new code:** If diff introduces new functions/classes with no corresponding tests, flag as HIGH44- [ ] **Test tests the mock, not the code:** If new tests mock so thoroughly that removing the implementation would still pass, flag as HIGH45- [ ] **Coverage regression:** If coverage report shows new code is <50% covered, flag as HIGH4647### MEDIUM — Fix if quick, log if not48- [ ] **Misleading names:** function or variable name doesn't describe what it does49- [ ] **Duplicated logic:** same code copy-pasted in 2+ places (extract it)50- [ ] **Magic values:** hardcoded numbers or strings that should be named constants51- [ ] **Function too long:** over 50 lines — candidate for splitting5253### LOW — Note and move on54- [ ] Missing comment on non-obvious logic55- [ ] Formatting inconsistency (prefer linter over manual fix)56- [ ] TODO left in code that should be a tracked ticket5758---5960## How to Run61621. **Get the diff:**63```bash64git diff # unstaged changes65git diff --staged # staged changes66git diff HEAD~1 # last commit67```68692. **Go through checklist top-down.** Don't spend time on LOW if CRITICAL exists.70713. **File each finding** with this format:72```73[SEVERITY] path/to/file.py:42 — what's wrong → specific fix74```75764. **Adversarial Pass (Devil's Advocate):**77After the checklist, flip your mindset. You are now an attacker trying to BREAK this code.78- "What input would crash this?" — pick 3 edge cases and mentally trace them79- "What assumption is wrong?" — list every implicit assumption, challenge each one80- "What happens under load/concurrency?" — race conditions, shared state, non-atomic ops81- "If I deleted the implementation but kept the tests, would tests still pass?" — mock integrity82- 60%+ of effort here should be DISCONFIRMATION, not confirmation. Ask "why X fails" not "why X works"83- If this pass finds something the checklist missed, promote it to the appropriate severity level84855. **Output a verdict:**86- ✅ **Ship** — no CRITICAL or HIGH findings87- ⚠️ **Fix first** — HIGH findings present88- 🚫 **Block** — CRITICAL found8990---9192## Output Format9394```95Code Review — <feature or file name>96Reviewed: <git diff range>9798CRITICAL (N)99- [CRITICAL] src/auth.py:15 — API key hardcoded → move to os.environ.get("API_KEY")100101HIGH (N)102- [HIGH] src/api.js:88 — fetch() not awaited → add await103104MEDIUM (N)105- [MEDIUM] src/utils.py:30 — magic number 86400 → extract as SECONDS_PER_DAY106107LOW (N)108- [LOW] src/models.py:55 — missing docstring on public method109110Verdict: ✅ Ship / ⚠️ Fix HIGH before merge / 🚫 Block111```112113---114115## What NOT to Flag116117- **Style/formatting** a linter handles → run the linter instead118- **"I would have done it differently"** preferences → only flag if correctness is affected119- **Architectural concerns** already decided → raise separately, don't block this review120- **Test edge cases beyond the spec** → nice to have, not a blocker121- **Entire file quality** when only reviewing a diff → stay scoped to what changed122- Do not request architecture changes in a code review — that belongs to a design/architecture pass123- Do not request refactoring for code NOT in the diff — stay in scope124- Do not flag style issues if there's a linter/formatter configured — trust the tooling125126---127128## Quick Reference129130| Situation | Action |131|-----------|--------|132| Found a CRITICAL | Stop. Fix before anything else. |133| Found only MEDIUM/LOW | Ship with notes — document as TODOs |134| Unsure if it's a bug | Check with a failing test — if you can write one, it's a bug |135| Hard to review your own code | Use the checklist sequentially — don't free-form |136| Reviewing a large diff | Break it into logical chunks, review each separately |137138---139140## Review the Review141Before presenting findings:1421. Re-read your critique. Is each point actionable and specific, or vague?1432. Did you miss anything by focusing too much on one area?1443. Are you being performatively thorough (flagging non-issues to seem careful) or genuinely helpful?1454. Would a senior engineer agree with your top 3 findings?146Strip any finding that doesn't pass these checks.147148### Architecture Step-Back149After reviewing individual code quality, zoom out:150- Does this change fit well with the existing architecture, or is it fighting it?151- If this pattern were extended to 10 similar cases, would the codebase be better or worse?152- Is there a simpler design that achieves the same goal?153These are LOW severity observations — note them and move on. But they compound into real architectural improvements over time.154155---156157## Second Opinion158159After completing the review, consider running an independent reviewer for a different model's perspective — many CLIs expose a one-shot review command (e.g. a `review --uncommitted` or `review <diff>` subcommand). A second model often catches what the first missed.160161---162163## Skill Chain164165| Stage | Skill |166|-------|-------|167| Before (writing the code) | **tdd-workflow** — tests first, then implementation |168| This skill | **code-review-session** — review before committing |169| Next (committing) | a git-workflow pass — conventional commit, right branch |170| If CRITICAL security found | **security-audit** — full audit if secrets or injection risk |171| If CRITICAL bug found | **debug-session** — diagnose root cause before fixing |172| After fix | **tdd-workflow** — add regression test for the bug found |173| For deep adversarial scrutiny | **devil-advocate** — stress-test the change against its own assumptions |174175---176177## Trigger Conditions178179Use this skill when:180- You just wrote or modified code and want a pre-commit / pre-merge check ("review this code", "check my code", "look at what I wrote", "code review").181- You finished a feature or bug fix, or completed a tdd-workflow green phase.182- You are about to `git commit` a non-trivial change.183184Do NOT use it for design reviews, architecture discussions, or whole-codebase audits — this skill reviews a **diff**, not a system.185186## Out of Scope187188- NOT for full codebase security audits — use `security-audit` instead189- NOT for diagnosing root cause of a bug — use `debug-session` instead190- NOT for architectural planning or design decisions — use `spec-driven-dev` or `decision-log` instead191- NEVER use this for reviewing an entire repo — scope to the diff only192193## Common Traps194195- **Reviewing code you haven't read**: Always read the file before commenting — reviewing a diff without understanding the surrounding code leads to incorrect or irrelevant suggestions.196- **Suggesting changes that conflict with project rules**: Check the project's own conventions and rules files first — the project may have hard rules that override general best practices.197- **Over-reviewing trivial changes (formatting, style) instead of logic/architecture**: Focus on substance — if a linter handles it, don't flag it. Spend review time on correctness, security, and design.