Skill — Code Review Methodology
When this skill activates
Any task involving establishing code review practices, creating review checklists,
defining PR standards, improving review feedback quality, or performing a structured review.
Mandatory actions when this skill is active
Before starting a review
- Check PR size — if >800 lines, request the author split it.
- Read the PR description to understand intent before reading code.
- Identify the review depth needed (critical path = deep, config = surface).
During review
- Review in priority order: correctness → security → performance → readability → style.
- Categorize every comment (blocking, suggestion, question, praise).
- Ask "What about X?" not "You should X."
- Limit blocking comments to actual blockers — save nitpicks for suggestions.
After review
- Summarize overall assessment in the review summary.
- State clearly: Approve, Request Changes, or Comment.
- If Request Changes, list the specific blocking items.
Review priority matrix
| Priority |
Category |
Examples |
| 1 (Critical) |
Correctness |
Logic bugs, data loss, race conditions |
| 2 (High) |
Security |
Auth bypass, injection, secret exposure |
| 3 (Medium) |
Performance |
N+1 queries, missing indexes, memory leaks |
| 4 (Low) |
Readability |
Unclear names, missing comments, complex nesting |
| 5 (Minimal) |
Style |
Formatting, import order, bracket placement |
Focus 80% of review effort on priorities 1-3. Style issues should be handled by linters, not humans.
PR sizing guidelines
| Size |
Lines Changed |
Review Time |
Quality |
| XS |
<50 |
5 min |
Excellent |
| S |
50-200 |
15 min |
Good |
| M |
200-400 |
30 min |
Acceptable |
| L |
400-800 |
60 min |
Risky |
| XL |
>800 |
??? |
Split it |
Rules:
- Ideal PR: <400 lines of meaningful changes (exclude generated code, lockfiles).
- If a PR is large, split into: refactoring prep → core change → cleanup.
- One logical change per PR. "While I was here" changes go in separate PRs.
Comment types
Blocking (must fix before merge)
[blocking] This SQL query is vulnerable to injection.
Use parameterized queries: `db.query('SELECT * FROM users WHERE id = $1', [id])`
Suggestion (consider, but not required)
[suggestion] Consider extracting this into a helper function —
it appears three times across this file and `utils.ts`.
Question (help me understand)
[question] What happens if `user` is null here?
I don't see a null check upstream.
Praise (reinforce good patterns)
[praise] Great use of the builder pattern here —
much cleaner than the previous imperative approach.
LGTM criteria
A PR is ready to merge when ALL of these are true:
Review depth by change type
Deep Review (read every line, trace data flow)
- Auth/security code
- Payment/billing logic
- Data migrations
- Public API changes
- Core business logic
Standard Review (understand intent, spot issues)
- New features
- Bug fixes
- Internal refactoring
- Test additions
Surface Review (sanity check, trust CI)
- Dependency updates (check changelog, breaking changes)
- Config changes (verify values are correct)
- Documentation updates (check accuracy)
- Generated code (verify generator config, spot-check output)
Feedback style guide
Do
- "What about handling the case where X is empty?"
- "Nice pattern — this is cleaner than the previous approach."
- "Could you add a comment explaining why this timeout is 30s?"
- "I think there's an edge case: [describe scenario]"
Don't
- "You should use X instead." (prescriptive without context)
- "This is wrong." (unconstructive)
- "Why didn't you just do X?" (implies incompetence)
- "Nit: [style preference]" on every other line (use a linter)
Principles
- Assume the author had a reason. Ask before suggesting alternatives.
- Be specific: "line 42 could throw if
data is null" not "error handling is missing."
- Offer solutions with your criticism — show a better approach.
- Praise patterns you want to see more of (positive reinforcement works).
Common things to check
Correctness
- Off-by-one errors in loops and ranges.
- Null/undefined handling on external data.
- Race conditions in async code.
- Error paths — what happens when things fail?
Security
- User input flows to SQL/HTML/shell without sanitization?
- Auth checks on every protected endpoint?
- Secrets hardcoded or logged?
- CORS/CSRF properly configured?
Performance
- N+1 queries in loops?
- Missing database indexes for query patterns?
- Unbounded data fetches (no LIMIT)?
- Expensive operations in hot paths?
Maintainability
- Will the next developer understand this in 3 months?
- Are there tests to catch regressions?
- Is the abstraction level consistent?
- Are error messages actionable?
Anti-patterns to avoid
- Rubber-stamping (approving without reading — defeats the purpose).
- Nitpick storms (10 style comments on a 20-line PR — use a linter).
- Gatekeeping (blocking for subjective preferences, not objective issues).
- Drive-by reviews (leaving one comment, never returning for follow-up).
- "I would have done it differently" without identifying an actual problem.
- Reviewing only the diff, not the context (the bug might be in surrounding code).
Self-check before task completion
Before marking a task done when this skill was active:
1---2name: code-review-methodology3description: Skill — Code Review Methodology4---56# Skill — Code Review Methodology78## When this skill activates9Any task involving establishing code review practices, creating review checklists,10defining PR standards, improving review feedback quality, or performing a structured review.1112## Mandatory actions when this skill is active1314### Before starting a review151. Check PR size — if >800 lines, request the author split it.162. Read the PR description to understand intent before reading code.173. Identify the review depth needed (critical path = deep, config = surface).1819### During review20- Review in priority order: correctness → security → performance → readability → style.21- Categorize every comment (blocking, suggestion, question, praise).22- Ask "What about X?" not "You should X."23- Limit blocking comments to actual blockers — save nitpicks for suggestions.2425### After review26- Summarize overall assessment in the review summary.27- State clearly: Approve, Request Changes, or Comment.28- If Request Changes, list the specific blocking items.2930## Review priority matrix3132| Priority | Category | Examples |33|----------|----------|----------|34| 1 (Critical) | Correctness | Logic bugs, data loss, race conditions |35| 2 (High) | Security | Auth bypass, injection, secret exposure |36| 3 (Medium) | Performance | N+1 queries, missing indexes, memory leaks |37| 4 (Low) | Readability | Unclear names, missing comments, complex nesting |38| 5 (Minimal) | Style | Formatting, import order, bracket placement |3940Focus 80% of review effort on priorities 1-3. Style issues should be handled by linters, not humans.4142## PR sizing guidelines4344| Size | Lines Changed | Review Time | Quality |45|------|--------------|-------------|---------|46| XS | <50 | 5 min | Excellent |47| S | 50-200 | 15 min | Good |48| M | 200-400 | 30 min | Acceptable |49| L | 400-800 | 60 min | Risky |50| XL | >800 | ??? | Split it |5152Rules:53- Ideal PR: <400 lines of meaningful changes (exclude generated code, lockfiles).54- If a PR is large, split into: refactoring prep → core change → cleanup.55- One logical change per PR. "While I was here" changes go in separate PRs.5657## Comment types5859### Blocking (must fix before merge)60```61[blocking] This SQL query is vulnerable to injection.62Use parameterized queries: `db.query('SELECT * FROM users WHERE id = $1', [id])`63```6465### Suggestion (consider, but not required)66```67[suggestion] Consider extracting this into a helper function —68it appears three times across this file and `utils.ts`.69```7071### Question (help me understand)72```73[question] What happens if `user` is null here?74I don't see a null check upstream.75```7677### Praise (reinforce good patterns)78```79[praise] Great use of the builder pattern here —80much cleaner than the previous imperative approach.81```8283## LGTM criteria8485A PR is ready to merge when ALL of these are true:86- [ ] No blocking comments remain unresolved.87- [ ] Tests exist for the change (unit + integration where appropriate).88- [ ] CI pipeline passes (lint, type check, tests, build).89- [ ] Documentation updated if public API or behavior changed.90- [ ] No TODOs added without a linked issue/ticket.91- [ ] PR title and description accurately describe the change.9293## Review depth by change type9495### Deep Review (read every line, trace data flow)96- Auth/security code97- Payment/billing logic98- Data migrations99- Public API changes100- Core business logic101102### Standard Review (understand intent, spot issues)103- New features104- Bug fixes105- Internal refactoring106- Test additions107108### Surface Review (sanity check, trust CI)109- Dependency updates (check changelog, breaking changes)110- Config changes (verify values are correct)111- Documentation updates (check accuracy)112- Generated code (verify generator config, spot-check output)113114## Feedback style guide115116### Do117- "What about handling the case where X is empty?"118- "Nice pattern — this is cleaner than the previous approach."119- "Could you add a comment explaining why this timeout is 30s?"120- "I think there's an edge case: [describe scenario]"121122### Don't123- "You should use X instead." (prescriptive without context)124- "This is wrong." (unconstructive)125- "Why didn't you just do X?" (implies incompetence)126- "Nit: [style preference]" on every other line (use a linter)127128### Principles129- Assume the author had a reason. Ask before suggesting alternatives.130- Be specific: "line 42 could throw if `data` is null" not "error handling is missing."131- Offer solutions with your criticism — show a better approach.132- Praise patterns you want to see more of (positive reinforcement works).133134## Common things to check135136### Correctness137- Off-by-one errors in loops and ranges.138- Null/undefined handling on external data.139- Race conditions in async code.140- Error paths — what happens when things fail?141142### Security143- User input flows to SQL/HTML/shell without sanitization?144- Auth checks on every protected endpoint?145- Secrets hardcoded or logged?146- CORS/CSRF properly configured?147148### Performance149- N+1 queries in loops?150- Missing database indexes for query patterns?151- Unbounded data fetches (no LIMIT)?152- Expensive operations in hot paths?153154### Maintainability155- Will the next developer understand this in 3 months?156- Are there tests to catch regressions?157- Is the abstraction level consistent?158- Are error messages actionable?159160## Anti-patterns to avoid161- Rubber-stamping (approving without reading — defeats the purpose).162- Nitpick storms (10 style comments on a 20-line PR — use a linter).163- Gatekeeping (blocking for subjective preferences, not objective issues).164- Drive-by reviews (leaving one comment, never returning for follow-up).165- "I would have done it differently" without identifying an actual problem.166- Reviewing only the diff, not the context (the bug might be in surrounding code).167168## Self-check before task completion169170Before marking a task done when this skill was active:171172- [ ] Reviewed in priority order (correctness → security → performance → readability)?173- [ ] Every comment categorized (blocking/suggestion/question/praise)?174- [ ] No nitpicks marked as blocking?175- [ ] Summary provided with clear approve/request-changes verdict?176- [ ] Feedback is specific, constructive, and offers solutions?177- [ ] PR size is within guidelines (or split requested)?