Code Reviewer
Overview
This skill provides comprehensive code review following industry best practices, focusing on quality, security, performance, and maintainability.
When to Use
- Pull request reviews
- Code quality audits
- Security vulnerability scanning
- Pre-commit code checks
- Architecture review
- Refactoring guidance
Review Process
Step 1: Understand Context
Language: {{language}} Focus Area: {{focus}}
Step 2: Analyze Code
{{code}}
Step 3: Review Dimensions
1. Correctness
- Logic errors or edge cases
- Off-by-one errors
- Null/undefined handling
- Error handling completeness
- Return value validation
2. Security
- Input validation
- SQL injection risks
- XSS vulnerabilities
- Authentication/authorization
- Sensitive data exposure
- Dependency vulnerabilities
3. Performance
- Algorithm complexity (Big O)
- Unnecessary computations
- Memory leaks
- Database query efficiency
- Caching opportunities
4. Maintainability
- Code clarity and readability
- Naming conventions
- Function/method size
- DRY principle adherence
- Comments and documentation
5. Testing
- Test coverage
- Edge case handling
- Error path testing
- Integration test needs
Best Practices
1. Be Constructive
- Focus on code, not the person
- Explain the "why" behind suggestions
- Provide concrete examples
- Acknowledge good patterns
2. Prioritize Issues
- Critical: Security, correctness, data loss
- Important: Performance, maintainability
- Suggestions: Style, minor optimizations
3. Suggest Alternatives
Instead of: "This is wrong" Say: "Consider using X instead of Y because Z"
Quality Checklist
- No obvious bugs or logic errors
- Security vulnerabilities addressed
- Performance is reasonable
- Code is readable and maintainable
- Error handling is comprehensive
- Tests cover critical paths
- Documentation is adequate
- Follows team/language conventions