| name | source-command-cleanup |
| description | Clean technical debt, refactor, optimize, and simplify codebase |
source-command-cleanup
Use this skill when the user asks to run the migrated source command cleanup.
Command Template
Cleanup & Refactor
Scan codebase for technical debt and code smells. Clean, refactor, optimize.
Scope
Code Smells:
- Functions >20 lines → extract
- Duplication (3+ occurrences) → DRY
- Complexity (>3 nesting levels) → flatten
- Unused code/imports/variables → remove
- Commented code → delete
- Magic numbers → named constants
- Poor naming → clarify
Technical Debt:
- TODOs/FIXMEs → implement or delete
- Deprecated APIs → upgrade
- Outdated patterns → modernize
- Performance bottlenecks → optimize
- Memory leaks → fix
- Lint warnings → resolve
Optimization:
- Algorithm complexity → reduce
- N+1 queries → batch
- Unnecessary re-renders → memoize
- Large bundles → code split
- Unused dependencies → remove
Execution
- Scan entire codebase systematically
- Prioritize by impact (critical → major → minor)
- Clean incrementally with atomic commits
- Test after every change
- Report what was cleaned and impact
Commit Strategy
One commit per logical cleanup:
refactor(auth): extract validateToken function
perf(db): batch user queries to fix N+1
chore: remove unused imports and commented code
Exit Criteria
Report: Lines removed, complexity reduced, performance gains.