detect-code-smells
Identify code quality issues and anti-patterns. Use when reviewing code for maintainability problems.
When & Why to Use This Skill
The detect-code-smells skill is an automated code analysis tool designed to enhance software maintainability by identifying anti-patterns and quality issues. It evaluates source code for cyclomatic complexity, SOLID principle violations, and structural weaknesses, helping developers reduce technical debt and improve long-term code health.
Use Cases
- Pre-merge Code Reviews: Automatically scan pull requests to identify maintainability issues and anti-patterns before code is integrated into the main branch.
- Technical Debt Auditing: Analyze legacy codebases to pinpoint high-complexity areas and prioritize refactoring tasks based on severity and impact.
- Developer Mentorship: Provide junior developers with instant, objective feedback on coding standards, naming conventions, and design principles.
- Refactoring Planning: Generate detailed reports on code smells like duplication and magic numbers to guide architectural improvements and cleanup sprints.
| name | detect-code-smells |
|---|---|
| description | "Identify code quality issues and anti-patterns. Use when reviewing code for maintainability problems." |
| mcp_fallback | none |
| category | analysis |
| tier | 2 |
| user-invocable | false |
Detect Code Smells
Identify code quality issues, anti-patterns, and maintainability problems that suggest need for refactoring.
When to Use
- Code review before merging
- Identifying refactoring priorities
- Mentoring and code quality improvement
- Planning technical debt reduction
Quick Reference
# Python code smell detection
pip install pylint radon
pylint --disable=all --enable=convention,refactor module.py
radon cc -a module.py # Cyclomatic complexity
radon mi -s module.py # Maintainability index
Workflow
- Scan for patterns: Identify common code smell patterns (long functions, duplication, magic numbers)
- Check complexity: Measure cyclomatic and cognitive complexity
- Evaluate naming: Check for unclear variable/function names
- Review structure: Identify violations of SOLID principles
- Document findings: List smells with severity and recommendations
Output Format
Code quality report:
- Code smell type (duplication, long method, magic number, etc.)
- Location (file:line)
- Severity (critical/high/medium/low)
- Explanation of the issue
- Suggested fix or refactoring approach
References
- See CLAUDE.md > SOLID principles for design guidance
- See CLAUDE.md > DRY and KISS principles for quality standards
- See
refactor-codeskill for applying fixes