code-reviewer
WHEN: Code review, quality check, code smell detection, refactoring suggestionsWHAT: Complexity analysis + code smell list + severity-based issues + improvement suggestionsWHEN NOT: Next.js specific → nextjs-reviewer, Security → security-scanner, Performance → perf-analyzer
When & Why to Use This Skill
The Code Reviewer skill is a comprehensive automated analysis tool designed to enhance software quality through deep code inspection. It identifies code smells, architectural weaknesses, and naming inconsistencies while providing actionable refactoring suggestions. By analyzing cyclomatic complexity and structural patterns, it helps developers maintain high standards of readability, maintainability, and performance across their projects.
Use Cases
- Automated Pull Request (PR) Reviews: Streamline the development workflow by automatically scanning code changes for bugs, logic errors, and style violations before merging.
- Legacy Code Refactoring: Identify technical debt such as 'God Objects', deep nesting, and long functions to guide systematic code improvement and modernization.
- Enforcing Coding Standards: Ensure consistency across the codebase by detecting naming convention violations and DRY (Don't Repeat Yourself) principle breaches.
- Complexity Management: Use cognitive and cyclomatic complexity metrics to pinpoint overly complicated logic that requires simplification for better testability.
| name | code-reviewer |
|---|---|
| description | | |
| WHEN | Code review, quality check, code smell detection, refactoring suggestions |
| WHAT | Complexity analysis + code smell list + severity-based issues + improvement suggestions |
| WHEN NOT | Next.js specific → nextjs-reviewer, Security → security-scanner, Performance → perf-analyzer |
Code Reviewer Skill
Purpose
Analyzes code quality, detects code smells, and suggests improvements.
When to Use
- Code review requests
- Code quality, code smell mentions
- Post-implementation review
- Pre-merge PR review
Workflow
Step 1: Review Scope
AskUserQuestion:
"What code should I review?"
Options:
- Current changes (git diff)
- Specific file/folder
- Full project scan
- Recent commits
Step 2: Review Focus
AskUserQuestion:
"What should I focus on?"
Options:
- Full quality check (recommended)
- Bugs/Logic errors
- Code style/Readability
- Performance issues
- Security vulnerabilities
multiSelect: true
Step 3: Analysis
- Complexity: Cyclomatic, Cognitive
- Duplication: DRY violations
- Naming: Variable/function naming quality
- Structure: Function length, nesting depth, parameter count
Detection Rules
Code Smells
| Smell | Threshold | Severity |
|---|---|---|
| Long Function | > 50 lines | MEDIUM |
| Deep Nesting | > 3 levels | HIGH |
| Magic Numbers | Hardcoded numbers | LOW |
| Long Parameter List | > 4 params | MEDIUM |
| God Object | > 20 methods | HIGH |
| Duplicate Code | > 10 lines | HIGH |
Naming Conventions
| Type | Pattern |
|---|---|
| Function | camelCase, verb prefix |
| Variable | camelCase, noun |
| Constant | UPPER_SNAKE_CASE |
| Class | PascalCase |
| File | kebab-case or PascalCase |
Response Template
## Code Review Results
**Target**: [path]
### CRITICAL (Fix immediately)
- **[Issue]** `file:line`
- Problem: [description]
- Solution: [suggestion]
### HIGH | MEDIUM | LOW
- ...
### Positive Patterns
- [Well-written code mentions]
### Summary
- Total issues: X
- Critical: X | High: X | Medium: X | Low: X
Best Practices
- Provide specific, actionable feedback with solutions
- Group by severity: Critical > High > Medium > Low
- Include positive feedback
- Provide copy-paste ready code fixes
- Respect project conventions
Integration
/analyze-codecommandsecurity-scannerskillperf-analyzerskill
Notes
- Reviews are suggestions, final decisions are developer's
- Maintain consistency with existing project conventions
- Use with automated linters (ESLint, Prettier)