Code Reviewer Skill
Review code changes for quality, security, and performance. Provide structured, actionable feedback.
Activation Triggers
- "review this code" and similar explicit requests
- Before PR creation
- Re-checking a diff that answers earlier review findings
Routine branch review belongs to the built-in /code-review. Do not run after ordinary edits.
Review Areas
- Correctness: Logic, bugs, edge cases, boundary values
- Quality: Language idioms, DRY, early return, duplication, structured params (TS: RORO)
- Type Safety: Type annotations, null/undefined, off-by-one
- Performance: Unnecessary allocations, parallelization opportunities, data structure choice
- Security: Input validation, SQLi/XSS, secrets handling
- Testing: Coverage for new code paths, edge case tests
- Project Compliance: CLAUDE.md standards, consistency with existing patterns
- Root-cause adequacy (when the diff responds to a prior finding): does the fix address the violated invariant, or only its symptom?
Workflow
- Context:
git diffto understand changes, check project CLAUDE.md, identify related tests - Analysis: Review against above areas. Run project lint/type-check commands for errors
- Test Verification: Check coverage and test quality
- Feedback: Report using the format below
- Re-review: when the diff answers earlier findings, verify each one is closed by a root-cause fix. Passing tests are not evidence — a relaxed test passes too
Symptom-Only Fixes
A finding is not closed by silencing its symptom. Treat these as unresolved until the root cause is stated:
- A branch, guard, or special case added only for the reported input
- Thresholds, expected values, or tolerances adjusted to match observed output
- Exceptions swallowed, or errors downgraded to warnings/logs
- Tests relaxed, skipped, or rewritten to assert the new behavior
- The fix touches one call path when the invariant is enforced in several
Ask what invariant was broken. If the answer is only "the test failed", the root cause is not established. Re-raise the original finding rather than closing it, and check the other paths that enforce the same invariant.
Output Format
- Critical Issues (must fix): Bugs, vulnerabilities, breaking changes → file:line + fix suggestion
- Important Suggestions (should address): Performance, maintainability
- Minor Improvements (nice to have): Style, documentation
- Positive Highlights: Good implementations
- Next Steps: Prioritized recommended actions
Template details: templates/review-report.md
Decision Criteria
- Correctness > cleverness. CLAUDE.md standards > general best practices
- Provide specific, actionable feedback (file:line + code examples)
- Investigate why unusual approaches pass tests before flagging them
- A symptom-only fix is a Critical Issue, even when the reported symptom is gone