arabelatso/skills-4-se/code-smell-detector
- community
Checking that the SKILL.md file is still in the repository.
Identify and report code smells indicating poor design or maintainability issues in Python code, including duplicate code, magic numbers, hardcoded values, God classes, feature envy, inappropriate intimacy, data clumps, primitive obsession, and long parameter lists. Use when conducting code quality audits, preparing for refactoring, improving codebase maintainability, or performing design reviews. Produces markdown reports with severity ratings, locations, descriptions, and specific refactoring recommendations with before/after examples. Triggers when users ask to find code smells, identify design issues, suggest refactorings, improve code quality, or detect maintainability problems.
Install
npx vskill@latest install arabelatso/skills-4-se/code-smell-detectorSKILL.md
Code Smell Detector
Overview
Identify code quality and design smells in Python codebases, then provide specific refactoring recommendations to improve maintainability and design.
Workflow
1. Understand the Analysis Scope
Define what to analyze:
Questions to ask:
- What directory or files should be analyzed?
- Focus on quality smells, design smells, or both?
- Are there specific concerns (e.g., "this class is too complex")?
- Should test files be included?
Determine scope:
2. Detect Code Smells
Use multiple detection strategies.
Strategy 1: Automated Detection
Use the bundled script for AST-based analysis:
What it detects:
- Long methods (>50 lines)
- Too many parameters (>5)
- Large classes (>15 methods)
- God classes (>20 methods)
- Magic numbers
Strategy 2: Manual Code Review
Read the code to identify design smells. See smell-patterns.md for comprehensive catalog.
Look for:
Code Quality Smells:
- Duplicate code blocks
- Magic numbers (unexplained numeric literals)
- Hardcoded values (paths, URLs, config)
- Commented-out code
- Inconsistent naming
Design Smells:
- God classes (too many responsibilities)
- Feature envy (method uses more from another class)
- Inappropriate intimacy (classes too coupled)
- Data clumps (same parameters repeated)
- Primitive obsession (using primitives instead of objects)
- Long parameter lists (>5 parameters)
Search patterns:
Strategy 3: Use External Tools
radon - Complexity metrics:
pylint - Code quality:
3. Categorize Smells
Organize findings by severity and type.
See smell-patterns.md for detailed patterns.
High Severity
Immediate attention needed:
- God classes (>20 methods, multiple responsibilities)
- Shotgun surgery (changes ripple across many files)
- Feature envy (method belongs in different class)
- Long parameter lists (>7 parameters)
Medium Severity
Should refactor soon:
- Large classes (>15 methods)
- Duplicate code
- Data clumps
- Primitive obsession
- Inappropriate intimacy
Low Severity
Nice to improve:
- Magic numbers
- Hardcoded values
- Inconsistent naming
- Lazy classes
- Commented-out code
4. Identify Refactorings
For each smell, determine appropriate refactoring.
See refactoring-patterns.md for detailed examples.
Common mappings:
| Smell | Refactoring | |
|---|---|---|
| God class | Extract Class, Extract Service | |
| Feature envy | Move Method | |
| Duplicate code | Extract Method, Pull Up Method | |
| Data clumps | Introduce Parameter Object | |
| Magic numbers | Replace with Symbolic Constant | |
| Long parameter list | Introduce Parameter Object | |
| Primitive obsession | Replace Data Value with Object | |
| Inappropriate intimacy | Move Method, Hide Delegate | |
| Shotgun surgery | Move Method, Inline Class | |
| Lazy class | Inline Class, Collapse Hierarchy |
5. Generate Report
Create a structured markdown report with specific refactoring recommendations.
Code Smell Analysis Report
Project: [Project Name] Analyzed: [Date] Scope: [Directories analyzed] Excluded: [Excluded directories]
Summary
- High severity smells: X issues
- Medium severity smells: Y issues
- Low severity smells: Z issues
Total: N code smells detected
🔴 High Severity Smells
Smell 1: God Class
Location: src/services/user_manager.py:15
Class: UserManager
Description: Class has 28 methods handling multiple unrelated responsibilities (user CRUD, authentication, email, logging, analytics).
Impact:
- Violates Single Responsibility Principle
- Hard to test and maintain
- Changes ripple across unrelated features
Refactoring: Extract Class
Recommendation:
Split into focused classes by responsibility:
Priority: High - Refactor within 1-2 sprints
Smell 2: Feature Envy
Location: src/models/order.py:45
Method: Order.calculate_total()
Description: Method uses customer features heavily (discount_rate, is_premium, shipping_address) rather than its own class features.
Impact:
- Poor cohesion - method is in wrong class
- Changes to Customer affect Order
- Violates "tell, don't ask" principle
Refactoring: Move Method
Recommendation:
Move calculation logic to Customer class:
Priority: High - Refactor within 2 weeks
🟡 Medium Severity Smells
Smell 3: Duplicate Code
Locations:
src/validators/user_validator.py:23-35src/validators/profile_validator.py:45-57
Description: Identical email and name validation logic appears in two validators.
Impact:
- Changes must be made in multiple places
- Risk of inconsistent validation
- Maintenance burden
Refactoring: Extract Method
Recommendation:
Extract common validation into shared utility:
Priority: Medium - Refactor within month
Smell 4: Data Clumps
Locations:
src/services/email_service.py:12(6 parameters)src/services/sms_service.py:23(6 parameters)src/services/notification_service.py:34(6 parameters)
Description: Same parameter group (name, email, phone, address_street, address_city, address_zip) appears in multiple methods.
Impact:
- Suggests missing abstraction
- Hard to maintain - changes affect many signatures
- Easy to pass wrong parameters
Refactoring: Introduce Parameter Object
Recommendation:
Create ContactInfo value object:
Priority: Medium - Refactor within month
🔵 Low Severity Smells
Smell 5: Magic Numbers
Location: src/billing/calculator.py:67-78
Description: Multiple unexplained numeric literals (1000, 0.15, 500, 0.10, 0.05).
Impact:
- Unclear business rules
- Hard to change discount thresholds
- Risk of typos
Refactoring: Replace Magic Number with Symbolic Constant
Recommendation:
Use named constants:
Priority: Low - Refactor when touching this code
Recommendations
Immediate Actions (High Priority)
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/code-smell-detector/SKILL.md
Popularity
- Repository stars
- 252
- Repository forks
- 24
- 7-day trend score
- 28
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 18 Mar 2026, 7 months ago.
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/code-smell-detector)