arabelatso/skills-4-se/design-smell-detector
Claude Code and agent skill by arabelatso/skills-4-se
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Identify design quality issues in code including high coupling, low cohesion, God classes, long methods, and other code smells. Use when: (1) Reviewing code architecture and design quality, (2) Identifying refactoring opportunities, (3) Detecting God classes or classes with too many responsibilities, (4) Finding high coupling or low cohesion issues, (5) Analyzing code maintainability and technical debt. Detects coupling smells, cohesion problems, complexity issues, size violations, and encapsulation problems with actionable refactoring suggestions.
Install
npx vskill@latest install arabelatso/skills-4-se/design-smell-detectorSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
Design Smell Detector
Identify and address design quality issues in code through automated smell detection and refactoring guidance.
Quick Start
Detect Design Smells
Example Output
Design Smells Detected
Coupling Smells
High Coupling: Too many dependencies
- Module imports > 20
- Constructor dependencies > 10
- Changes cascade across classes
Feature Envy: Method uses other class more than own
- External access > internal access
- Method should move to envied class
Inappropriate Intimacy: Classes too tightly coupled
- Accessing private fields of other classes
- Excessive use of getters/setters
Cohesion Smells
Low Cohesion: Class members unrelated
- LCOM (Lack of Cohesion) > 0.7
- Methods don't share instance variables
- Class has multiple responsibilities
God Class: Class knows/does too much
- Methods > 20
- Attributes > 15
- Lines of code > 500
Complexity Smells
High Cyclomatic Complexity: Too many decision points
- Complexity > 10
- Deeply nested conditionals
- Many if/else, loops
Long Method: Method too long
- Lines of code > 50
- Multiple responsibilities
- Hard to understand
Size Smells
Long Parameter List: Too many parameters
- Parameters > 5
- Related parameters not grouped
- Method signature hard to understand
Large Module: Module too large
- Classes > 20
- Lines of code > 1000
- Multiple responsibilities
Encapsulation Smells
Data Class: Only data, no behavior
- Only getters/setters
- No business logic
- Missing encapsulation
Exposed Internal State: Implementation details exposed
- Public mutable fields
- Returns references to internal collections
- Breaks encapsulation
Detection Workflow
1. Run Detection
Analyze codebase for design smells:
2. Review Results
Examine detected smells by severity:
- Critical: God classes, severe coupling issues
- Major: Low cohesion, long methods, high complexity
- Minor: Long parameter lists, feature envy
3. Prioritize Refactoring
Focus on:
- Critical issues first
- Frequently changed code
- High-impact, low-effort improvements
4. Apply Refactoring
Use refactoring strategies based on smell type.
See [refactoring_strategies.md](references/refactoring_strategies.md) for detailed solutions.
5. Verify Improvements
Re-run detection to measure progress:
Compare metrics before/after.
Common Design Smells
God Class
Symptoms:
- Too many methods (>20)
- Too many attributes (>15)
- Low cohesion
- Multiple responsibilities
Example:
Refactoring:
High Coupling
Symptoms:
- Too many imports (>20)
- Too many constructor dependencies
- Changes cascade across classes
Example:
Refactoring:
Low Cohesion
Symptoms:
- Methods don't share attributes
- Class does unrelated things
- LCOM score > 0.7
Example:
Refactoring:
Long Method
Symptoms:
- Method > 50 lines
- Multiple responsibilities
- Hard to understand
Example:
Refactoring:
Refactoring Strategies
Reduce Coupling
Dependency Injection:
Interface Abstraction:
Improve Cohesion
Extract Class:
Move Method:
Reduce Complexity
Extract Method:
Replace Conditional with Polymorphism:
For comprehensive refactoring strategies, see [refactoring_strategies.md](references/refactoring_strategies.md).
Metrics and Thresholds
Detection Thresholds
| Smell | Metric | Threshold | |
|---|---|---|---|
| God Class | Methods | > 20 | |
| God Class | Attributes | > 15 | |
| God Class | LOC | > 500 | |
| High Coupling | Imports | > 20 | |
| Low Cohesion | LCOM | > 0.7 | |
| Long Method | LOC | > 50 | |
| High Complexity | Cyclomatic | > 10 | |
| Long Parameter List | Parameters | > 5 |
Key Metrics
LCOM (Lack of Cohesion of Methods):
- Measures how methods share instance variables
- Range: 0.0 (high cohesion) to 1.0 (low cohesion)
- Lower is better
Cyclomatic Complexity:
- Number of linearly independent paths
- Each if/while/for adds 1
- Lower is better (< 10)
Fan-out (Coupling):
- Number of dependencies
- Lower is better (< 10)
Design Smell Catalog
For complete descriptions, examples, and solutions for all design smells, see [smell_catalog.md](references/smell_catalog.md).
Includes:
- Coupling Smells: High coupling, Feature Envy, Inappropriate Intimacy
- Cohesion Smells: Low cohesion, God Class
- Complexity Smells: High complexity, Long Method
- Size Smells: Long Parameter List, Large Module
- Encapsulation Smells: Data Class, Exposed Internal State
Best Practices
1. Detect Regularly
Integrate into workflow:
2. Track Metrics Over Time
Monitor trends:
3. Prioritize Strategically
Focus on:
- Code changed frequently
- Critical business logic
- High-impact areas
4. Refactor Incrementally
- Small, safe changes
- Run tests after each change
- Commit frequently
5. Measure Improvements
Before/after metrics:
Common Scenarios
Scenario 1: Legacy Codebase Modernization
Goal: Identify technical debt in legacy system
Approach:
- Run smell detection on entire codebase
- Generate metrics report
- Identify top 10 worst files
- Create refactoring backlog
- Tackle incrementally
Scenario 2: Code Review Enhancement
Goal: Automated design quality checks in PR reviews
Approach:
- Add smell detection to CI pipeline
- Fail build if critical smells introduced
- Report metrics in PR comments
- Require fixes before merge
Scenario 3: Architecture Assessment
Goal: Evaluate system architecture quality
Approach:
- Detect coupling and cohesion issues
- Identify God classes and large modules
- Analyze dependency structure
- Recommend architectural improvements
Integration with Development Workflow
Pre-commit Hook
CI/CD Pipeline
IDE Integration
Most IDEs support similar analysis through plugins:
- PyCharm: Built-in inspections for coupling/cohesion
- VS Code: Python linting extensions
- SonarLint: Real-time smell detection
Troubleshooting
False Positives
Problem: Legitimate design flagged as smell
Solution:
- Understand context and constraints
- Consider if threshold should be adjusted
- Document reasons for exception
Overwhelming Results
Problem: Too many smells to address
Solution:
- Filter by severity (critical first)
- Focus on frequently changed code
- Set incremental goals
Refactoring Breaks Tests
Problem: Tests fail after refactoring
Solution:
- Ensure comprehensive test coverage first
- Refactor incrementally
- Run tests after each small change
Reference Documentation
Design Smell Catalog
See [smell_catalog.md](references/smell_catalog.md) for:
- Complete smell definitions
- Detection criteria and thresholds
- Code examples (before/after)
- Metrics explanations (LCOM, cyclomatic complexity, fan-out)
- All coupling, cohesion, complexity, size, and encapsulation smells
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/design-smell-detector/SKILL.md
Popularity
- 7-day trend score
- 0
Refreshed 18 Mar 2026, 8 months ago.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/arabelatso/skills-4-se/design-smell-detector)