/code-practices:cleanupfrom code-practices
Systematic code cleanup after completing features. Use after refactoring or periodically to remove dead code, console statements, TODOs, and tech debt.
Ships in code-practices. Installing the plugin adds it to Claude Code.
Use after completing a feature, after refactoring, or periodically to maintain code health.
Karpathy: "They don't clean up dead code after themselves... They will implement an inefficient, bloated, brittle construction."
LLMs leave messes. This skill systematically cleans them up.
Remove code that is never executed:
# Find unused exports in TypeScript
npx ts-prune
# Find unused dependencies
npx depcheck
# Find unused variables (ESLint)
npx eslint --rule 'no-unused-vars: error' src/
Manual checks:
Delete it. Git remembers.
// BAD: Leaving commented code
// function oldImplementation() {
// // 50 lines of dead code...
// }
function newImplementation() { ... }
// GOOD: Just delete it
function newImplementation() { ... }
Remove debugging artifacts:
# Find console.log statements
grep -r "console\." src/ --include="*.ts" --include="*.tsx"
Address or delete:
# Find TODOs
grep -r "TODO\|FIXME\|HACK\|XXX" src/
Look for copy-paste patterns:
# Find duplicate code blocks
npx jscpd src/
If you see the same logic in multiple places, extract it.
Files that aren't imported anywhere:
# Find files not imported by anything
npx unimported
Dependencies that are no longer used:
npx depcheck
Unnecessary as casts that hide type errors:
// BAD: Hiding type errors
const user = data as User;
// GOOD: Proper type guards
function isUser(data: unknown): data is User {
return typeof data === 'object' && data !== null && 'id' in data;
}
if (isUser(data)) { ... }
## Cleanup Summary
### Removed
- 3 unused functions (150 lines)
- 12 unused imports
- 5 commented-out code blocks
- 2 unused dependencies
### Remaining Issues
- 8 TODO comments (see issues #12, #13)
- 3 console.log statements (intentional for debugging feature X)
### Lines Before: 5,432
### Lines After: 5,150
### Reduction: 282 lines (5.2%)
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub rahulsub/code-practices-plugin --plugin code-practices13 commands in this plugin
/code-reviewReview code like a skeptical senior engineer. Use when reviewing PRs, after generating significant code, or before merging changes./context-managementManage Claude Code sessions effectively. Use during long sessions, multi-step tasks, or when responses start degrading. Covers /clear, checklists, and subagents./explore-plan-codeStructured workflow for non-trivial tasks. Read files first, create detailed plan, get approval, then implement. Prevents premature coding.Other plugins' commands for the same job