A Claude Code slash command for analyzing technical debt and code complexity.
# Clone to your preferred location
git clone git@github.com:claude-commands/command-tech-debt.git <clone-path>/command-tech-debt
# Symlink (use full path to cloned repo)
ln -s <clone-path>/command-tech-debt/tech-debt.md ~/.claude/commands/tech-debt.md/tech-debt # Analyze current directory
/tech-debt src/ # Analyze specific directory
/tech-debt src/auth/login.ts # Analyze specific file
/tech-debt --full # Comprehensive analysis
- Scans for complexity hotspots (cyclomatic & cognitive)
- Detects code duplication patterns
- Identifies large files and long functions
- Finds code smells (TODO, FIXME, deep nesting)
- Generates prioritized remediation report
# Technical Debt Analysis
## Summary
| Metric | Value | Status |
|--------|-------|--------|
| Avg Cyclomatic Complexity | 8.2 | OK |
| Code Duplication | 3.2% | OK |
| Long Functions (>50 lines) | 12 | WARNING |
## Critical Issues (Fix First)
### 1. `src/services/payment.ts` - Complexity: 45
- Function `processPayment()` at line 120
- **Recommendation**: Extract into strategy pattern| Metric | OK | Warning | Critical |
|---|---|---|---|
| Cyclomatic Complexity | < 10 | 10-20 | > 20 |
| Function Length | < 50 | 50-100 | > 100 |
| File Length | < 300 | 300-500 | > 500 |
| Nesting Depth | < 4 | 4-5 | > 5 |
| Parameters | < 5 | 5-7 | > 7 |
| Duplication | < 5% | 5-10% | > 10% |
- Cyclomatic Complexity: Decision points per function
- Cognitive Complexity: Code understandability
- Code Duplication: Copy-paste and similar patterns
- Size Metrics: Function/file length, nesting depth
- Code Smells: TODO/FIXME, magic numbers, empty catches
- Git repository with source code
- Claude Code with Opus 4.5 model access
cd <clone-path>/command-tech-debt && git pull