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
The catalogue of symptom-only patterns lives in ~/.claude/CLAUDE.md(行動規範 > 問題解決・デバッグ). Read it and check the diff against that list rather than a copy kept here.
A finding is not closed by silencing its symptom. Two checks specific to re-review:
- The fix touches one call path when the invariant is enforced in several. Ask for the count of the other sites — the rules require it to be stated before the fix
- Ask what invariant was broken. If the answer is only "the test failed" or "the linter complained", 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