Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Analyze code for SOLID violations and suggest targeted improvements
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-03 | ✗→✓ | ▲ Improved | 16% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 27% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 39% | 0% |
| case-17 | ✗→✓ | ▲ Improved | -13% | 0% |
| case-18 | ✗→✓ | ▲ Improved | -14% | 0% |
Analyze code for SOLID violations and suggest targeted improvements.
Identify refactoring opportunities based on:
Determine the refactoring scope from user input:
bash# Get file/directory stats if [ -f "$TARGET" ]; then wc -l "$TARGET" echo "Single file analysis" elif [ -d "$TARGET" ]; then find "$TARGET" -type f \( -name "*.ts" -o -name "*.js" -o -name "*.py" \) | wc -l echo "Directory analysis" fi
Look for:
bash# Find large files find . -name "*.{ts,js,py}" -exec wc -l {} + 2>/dev/null | sort -rn | head -10 # Functions with high line count (approximate) grep -rn "function\|def \|fn " --include="*.{ts,js,py,rs}" . | head -20
Look for:
Look for:
Look for:
Look for:
new Service())bash# Duplication patterns grep -rn --include="*.{ts,js,py}" . 2>/dev/null | \ awk -F: '{print $3}' | sort | uniq -c | sort -rn | head -10 # Long parameter lists (> 4 params) grep -rn "function.*,.*,.*,.*," --include="*.{ts,js}" . 2>/dev/null | head -10 # Deep nesting (4+ levels) grep -rn "^\s\{16,\}" --include="*.{ts,js,py}" . 2>/dev/null | head -10
For each issue found, assess:
Target: file/directory] Lines Analyzed: count]
| Principle | Status | Issues Found | |-----------|--------|--------------| | Single Responsibility | 🟡 | 3 large classes | | Open/Closed | 🟢 | OK | | Liskov Substitution | 🟢 | OK | | Interface Segregation | 🔴 | 2 fat interfaces | | Dependency Inversion | 🟡 | 5 direct instantiations |
UserServiceViolation: Single Responsibility Current: 450 lines handling auth + profile + notifications Suggested:
UserService.ts (450 lines)
↓ Extract
AuthService.ts (~150 lines)
ProfileService.ts (~150 lines)
NotificationService.ts (~100 lines)Risk: Medium (update imports) Tests Needed: Update dependency injection in tests
Location: src/handlers/payment.ts:45 Current:
typescriptswitch (paymentType) { case 'card': // 50 lines case 'bank': // 50 lines case 'crypto': // 50 lines }
Suggested: Strategy pattern with PaymentProcessor interface Risk: Low (isolated change)
| Smell | Location | Severity | |-------|----------|----------| | Long Method | api.ts:calculateTotal (120 lines) | 🟠 High | | Duplicate Code | utils/*.ts (3 similar blocks) | 🟡 Medium | | Deep Nesting | parser.ts:parse (6 levels) | 🟡 Medium |
validateEmail() to shared utils (used in 4 places)processOrder()Before applying suggestions:
Analyze specific file:
/refactor src/services/user.tsAnalyze directory:
/refactor src/api/Focus on specific principle:
/refactor --focus=srp src/services/With complexity threshold:
/refactor --threshold=high$ARGUMENTS
Other measured skills in the registry, with their headline benchmark lift.