Code Review
Structured multi-pass review. Read the full diff before commenting on anything.
Phase 1: Orient
- Determine the review scope:
- If reviewing a PR:
git diff <base>..HEAD
- If reviewing staged changes:
git diff --cached
- If reviewing a file: read the file
- Understand the intent: read the commit messages, PR description, or
task description to understand what the change is supposed to do
- Identify the change type: feature, bugfix, refactor, config, dependency update
Phase 2: Critical Pass
Read the diff line by line. Flag only real issues:
Always check:
- Logic errors (wrong conditions, off-by-one, missing null checks on external data)
- SQL injection, XSS, command injection, path traversal
- Race conditions in concurrent code
- Resource leaks (unclosed handles, missing cleanup)
- Missing error handling at system boundaries (network, file I/O, user input)
- Breaking API contract changes without version bump
Never flag:
- Style preferences (naming, formatting) unless they cause confusion
- Missing comments on self-explanatory code
- Hypothetical edge cases that cannot happen given the invariants
- "I would have done it differently" without a concrete defect
Phase 3: Specialist Focus
Based on the change type, apply the relevant specialist lens:
If the diff touches tests:
- Do tests actually test behavior, or just assert mock return values?
- Are there tautological assertions (
expect(true).toBe(true))?
- Is the test coupled to implementation details rather than outcomes?
If the diff touches data access:
- N+1 query patterns in loops
- Unbounded result sets without pagination
- Transactions where atomic operations are needed
If the diff touches auth/security:
- Apply Phase 2-4 of the
security-audit skill to the changed code
If the diff touches UI:
- State management: are loading/error/empty states handled?
- Accessibility: keyboard navigation, semantic HTML, ARIA labels
- Responsive: does it work at mobile/tablet/desktop breakpoints?
Phase 4: Verdict
For each finding, assign a confidence level:
- High (8-10): Confirmed defect with clear evidence — fix before merge
- Medium (5-7): Likely issue, but may depend on context — discuss
- Low (1-4): Possible concern, worth noting — optional
Report format per finding:
[severity] file:line — description
Confidence: N/10
Suggestion: specific fix
Final verdict
- Approve: no High findings, no more than 2 Medium findings
- Request changes: any High finding, or 3+ Medium findings
- If nothing is wrong: say "no issues found" — do not invent problems
Rules
- Read the code before commenting — never review from the description alone
- Every finding must reference a specific file and line
- Do not suggest refactoring that is unrelated to the change being reviewed
- A review that flags nothing wrong is a valid review — do not pad
1---2name: code-review3description: Structured code review skill. Use when asked to "review this code", "review this PR", "check this diff", or when acting as a Hydra reviewer. Runs a multi-pass review with specialist focus areas and confidence-gated findings.4---56# Code Review78Structured multi-pass review. Read the full diff before commenting on anything.910## Phase 1: Orient11121. Determine the review scope:13 - If reviewing a PR: `git diff <base>..HEAD`14 - If reviewing staged changes: `git diff --cached`15 - If reviewing a file: read the file162. Understand the intent: read the commit messages, PR description, or17 task description to understand what the change is supposed to do183. Identify the change type: feature, bugfix, refactor, config, dependency update1920## Phase 2: Critical Pass2122Read the diff line by line. Flag only real issues:2324**Always check:**25- Logic errors (wrong conditions, off-by-one, missing null checks on external data)26- SQL injection, XSS, command injection, path traversal27- Race conditions in concurrent code28- Resource leaks (unclosed handles, missing cleanup)29- Missing error handling at system boundaries (network, file I/O, user input)30- Breaking API contract changes without version bump3132**Never flag:**33- Style preferences (naming, formatting) unless they cause confusion34- Missing comments on self-explanatory code35- Hypothetical edge cases that cannot happen given the invariants36- "I would have done it differently" without a concrete defect3738## Phase 3: Specialist Focus3940Based on the change type, apply the relevant specialist lens:4142**If the diff touches tests:**43- Do tests actually test behavior, or just assert mock return values?44- Are there tautological assertions (`expect(true).toBe(true)`)?45- Is the test coupled to implementation details rather than outcomes?4647**If the diff touches data access:**48- N+1 query patterns in loops49- Unbounded result sets without pagination50- Transactions where atomic operations are needed5152**If the diff touches auth/security:**53- Apply Phase 2-4 of the `security-audit` skill to the changed code5455**If the diff touches UI:**56- State management: are loading/error/empty states handled?57- Accessibility: keyboard navigation, semantic HTML, ARIA labels58- Responsive: does it work at mobile/tablet/desktop breakpoints?5960## Phase 4: Verdict6162For each finding, assign a confidence level:6364- **High (8-10)**: Confirmed defect with clear evidence — fix before merge65- **Medium (5-7)**: Likely issue, but may depend on context — discuss66- **Low (1-4)**: Possible concern, worth noting — optional6768Report format per finding:6970```71[severity] file:line — description72Confidence: N/1073Suggestion: specific fix74```7576## Final verdict7778- **Approve**: no High findings, no more than 2 Medium findings79- **Request changes**: any High finding, or 3+ Medium findings80- **If nothing is wrong**: say "no issues found" — do not invent problems8182## Rules8384- Read the code before commenting — never review from the description alone85- Every finding must reference a specific file and line86- Do not suggest refactoring that is unrelated to the change being reviewed87- A review that flags nothing wrong is a valid review — do not pad