Code Review Skill
Review code changes or entire files for quality, correctness, and best practices.
Usage
code
/crv [--staged] [--file <path>] [--full] [--thorough]
Options:
- •
--staged- Review only staged changes (default: all changes) - •
--file <path>- Review specific file only - •
--full- Review entire file(s), not just changes (requires--file) - •
--thorough- Perform deep analysis including security and performance
Examples:
bash
/crv # Review all unstaged changes /crv --staged # Review staged changes /crv --file src/Foo.cs # Review changes in specific file /crv --file src/Foo.cs --full # Review entire file (no changes required) /crv --thorough # Deep analysis
Instructions
When this skill is invoked:
- •
Determine scope based on arguments:
- •Parse
--staged,--file,--full, and--thoroughflags - •Default to reviewing all unstaged changes if no flags provided
- •If
--fullis provided without--file, inform user that--fileis required
- •Parse
- •
Gather changes using git (or read full file):
- •If
--fullflag is set:- •Read the entire file specified by
--fileusing the Read tool - •Skip git diff entirely - review the complete file contents
- •Read the entire file specified by
- •Otherwise use git diff:
- •For all changes:
git diff - •For staged:
git diff --cached - •For specific file:
git diff [--cached] -- <file> - •If no changes found, inform user and exit
- •For all changes:
- •If
- •
Context gathering:
- •Read affected files completely to understand full context
- •Check for related test files
- •Look for relevant documentation or schema files (e.g., Regions_V1.0.xsd)
- •
Perform review covering:
Always check:
- •Syntax errors and compilation issues
- •Logic errors and edge cases
- •Null reference handling
- •Exception handling appropriateness
- •Code consistency with existing patterns
- •Naming conventions
- •Unnecessary complexity or over-engineering
- •Missing validation at boundaries
- •Backwards compatibility issues (unused code should be deleted, not commented)
For C# specifically:
- •Proper using statements
- •LINQ query efficiency
- •Async/await usage
- •IDisposable implementation
- •Nullable reference handling
- •XML documentation on public APIs
If
--thoroughflag:- •Security vulnerabilities (SQL injection, XSS, command injection, etc.)
- •Performance implications (N+1 queries, excessive allocations, etc.)
- •Thread safety issues
- •Memory leaks or resource management
- •OWASP Top 10 vulnerabilities
- •
Review test changes:
- •If tests are modified, verify they test the right behavior
- •Check for missing test coverage of new functionality
- •Validate test assertions are meaningful
- •
Generate report with this structure:
markdown## Code Review Summary **Scope:** [describe what was reviewed] **Overall Assessment:** [APPROVE / NEEDS CHANGES / MAJOR ISSUES] ### Issues Found #### Critical (must fix) - [file:line] Issue description #### Important (should fix) - [file:line] Issue description #### Suggestions (consider) - [file:line] Suggestion description ### Positive Observations - Things done well ### Recommendations - General advice for improvement
- •
Be specific:
- •Reference exact file paths and line numbers (file:line format)
- •Quote problematic code snippets
- •Provide concrete fix suggestions
- •Explain WHY something is an issue
- •
Be balanced:
- •Point out good practices too
- •Don't nitpick minor style issues unless they impact readability
- •Focus on correctness, maintainability, and avoiding bugs
- •Don't suggest adding features beyond the change scope
Important Notes
- •This skill is for REVIEW only - don't make changes unless explicitly asked
- •Be objective and constructive in feedback
- •Prioritize correctness and security over style preferences
- •If no issues found, say so clearly
- •Always validate against project patterns (check CLAUDE.md if it exists)