Use when reviewing code quality, before refactoring, when complexity increases, when code feels "hard to change", during code review, or when onboarding to unfamiliar code - systematic identification of code smells with specific refactoring recipes
⭐2stars🔀0forks📁View on GitHub🕐Updated Jan 3, 2026⬇️2downloads
The Code Smell Detection skill is a specialized tool for software engineers and quality auditors designed to systematically identify technical debt and maintainability issues. By analyzing codebases for objective 'smells'—such as Bloaters, Couplers, and Dispensables—it provides actionable refactoring recipes to reduce complexity and improve code health. This skill acts as an automated auditor that helps teams maintain high standards of code quality, ensuring that software remains scalable and easy to modify over time.
Use Cases
Pre-Refactoring Assessment: Use the skill to pinpoint specific areas of high complexity and technical debt before starting a refactoring sprint to ensure efforts are focused on the most impactful areas.
Automated Code Quality Audits: Integrate the skill into the code review workflow to catch structural issues like 'Feature Envy' or 'Shotgun Surgery' that standard linters might miss.
Legacy Code Onboarding: Quickly map out the 'hard-to-change' sections and structural weaknesses of an unfamiliar or inherited codebase to accelerate the onboarding process.
Technical Debt Prioritization: Generate a prioritized report of code smells based on severity (High, Medium, Low) to help project managers and leads plan maintenance tasks effectively.
Continuous Quality Monitoring: Periodically scan the repository as complexity increases to prevent the accumulation of 'God Classes' and 'Long Methods' that hinder development velocity.
name
code-smell-detection
description
Use when reviewing code quality, before refactoring, when complexity increases, when code feels "hard to change", during code review, or when onboarding to unfamiliar code - systematic identification of code smells with specific refactoring recipes
Code Smell Detection
Persona: Code quality auditor who catalogs issues without judgment, focusing on objective metrics.
Flagging style preferences as smells (smell != dislike)
Reporting smells without refactoring recipes
Detecting smells in generated or vendored code
Smell Categories
Bloaters (Too Big)
Smell
Detection
Refactoring
Long Method
>20 lines, multiple indents
Extract Method
Large Class
>300 lines, many responsibilities
Extract Class
Long Parameter List
>3 parameters
Introduce Parameter Object
Primitive Obsession
Strings for IDs, ints for money
Value Object
Data Clumps
Same 3+ fields appear together
Extract Class
Change Preventers (Hard to Modify)
Smell
Detection
Refactoring
Divergent Change
One class changed for many reasons
Extract Class per reason
Shotgun Surgery
One change requires many file edits
Move Method, Inline Class
Couplers (Too Connected)
Smell
Detection
Refactoring
Feature Envy
Method uses another class more than own
Move Method
Message Chains
a.b().c().d()
Hide Delegate
Dispensables (Remove)
Smell
Detection
Refactoring
Dead Code
Unreachable, unused
Delete
Duplicate Code
Same logic in multiple places
Extract Method/Class
Comments
Explaining bad code
Refactor code to be clear
Detection
# Long methods/Large files
find ./src -name "*.py" -exec wc -l {} \; | awk '$1 > 300'
# Feature Envy: Count method's references to own vs other class
# If other > own, method belongs elsewhere
Refactoring Recipe: Extract Method
# Before: Long method with comment sections
def process_order(order):
# Validate order
if not order.items: raise ValueError("Empty order")
# Calculate totals
total = sum(item.price for item in order.items) * 1.1
# Notify
send_email(order.customer.email, f"Total: {total}")
# After: Extracted methods
def process_order(order):
validate_order(order)
total = calculate_total(order)
notify_customer(order.customer, total)