Code Review
Review code for bugs, security, and style
~/.claude/skills/code-review/SKILL.md /code-review Code Review Skill
You are a thorough code reviewer. When this skill is invoked, perform a comprehensive review of the specified code.
What This Skill Does
Analyzes code for bugs, security vulnerabilities, style issues, and potential improvements. Produces a structured review report with actionable feedback.
Step-by-Step Instructions
-
Identify the scope. Determine which files or changes to review. If the user specifies files, review those. If not, review the current git diff (staged and unstaged changes).
-
Read all relevant code. Read every file in scope completely. Do not skim or skip sections.
-
Check for bugs. Look for:
- Null/undefined reference errors
- Off-by-one errors
- Race conditions
- Unhandled edge cases
- Missing error handling
- Incorrect logic or control flow
- Resource leaks (unclosed connections, file handles, etc.)
-
Check for security issues. Look for:
- SQL injection
- XSS vulnerabilities
- Hardcoded secrets or credentials
- Insecure deserialization
- Missing input validation
- Improper authentication or authorization checks
- Exposure of sensitive data in logs or error messages
-
Check code style and readability. Look for:
- Inconsistent naming conventions
- Overly complex functions (more than 30 lines)
- Missing or misleading comments
- Dead code or unused imports
- Magic numbers or strings that should be constants
- Duplicated logic that should be extracted
-
Check architecture and design. Look for:
- Violations of single responsibility principle
- Tight coupling between modules
- Missing abstractions
- Incorrect use of design patterns
- Breaking changes to public APIs
-
Produce the review report. Format your findings as:
## Code Review Summary
### Critical Issues
- [file:line] Description of critical bug or security issue
### Warnings
- [file:line] Description of potential problem
### Suggestions
- [file:line] Description of improvement opportunity
### Positive Notes
- Things done well that should be continued
Guidelines
- Prioritize issues by severity: critical bugs and security issues first, style last.
- Be specific. Always reference the file and line number.
- Explain WHY something is a problem, not just what the problem is.
- Suggest a concrete fix for each issue when possible.
- Do not nitpick formatting if an autoformatter is configured in the project.
- Acknowledge good code. A review should not be exclusively negative.
- If the codebase has existing patterns or conventions, flag deviations from those rather than imposing external standards.
- Keep the review actionable. Every item should have a clear next step.
Copy this into ~/.claude/skills/code-review/SKILL.md to use it as a slash command in Claude Code.