/cleanup
Find and remove dead code, unused imports, and unreachable branches.
$ npx -y skills add rohitg00/awesome-claude-code-toolkit --agent claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/cleanup
Context preview
What this command does when you run it.
Find and remove dead code, unused imports, and unreachable branches.
Command definition
cleanup.mdFind and remove dead code, unused imports, and unreachable branches.
Steps
1. Detect the language and available tooling:
- TypeScript/JavaScript: Use `tsc --noEmit` for unused locals, `eslint` with `no-unused-vars`.
- Python: Use `vulture` or `pyflakes` for dead code detection.
- Go: `go vet` reports unused variables; `staticcheck` finds dead code.
- Rust: Compiler warnings for dead code with `#[warn(dead_code)]`.
2. Scan for unused exports:
- Find all exported symbols.
- Search the codebase for imports of each symbol.
- Flag exports with zero import references (excluding entry points).
3. Detect unreachable code:
- Code after unconditional return/throw/break statements.
- Branches with impossible conditions (always true/false guards).
- Feature flags that are permanently enabled or disabled.
4. Find unused dependencies:
- Compare `package.json` dependencies against actual imports.
- Check for packages used only in removed code.
5. Present findings grouped by category with confidence levels. 6. Apply removals only for high-confidence dead code (no dynamic references). 7. Run tests after each removal batch to catch false positives.
Format
Dead Code Analysis
==================
Unused imports: <N>
- <file>:<line> - import { <symbol> } from '<module>'
Unused exports: <N>
- <file>:<line> - export <symbol> (0 references)
Unreachable code: <N>
- <file>:<lines> - <reason>
Unused dependencies: <N>
- <package> (last used: never / removed in <commit>)
Safe to remove: <N> items
Needs review: <N> itemsRules
- Never remove code that might be used via dynamic imports, reflection, or string references.
- Preserve exports that are part of a public API or SDK.
- Skip test utilities, fixtures, and development-only code.
- Run the full test suite after removing each batch to catch false positives.
- Log removed code with git commit messages for easy reversal.
Read more
Find and remove dead code, unused imports, and unreachable branches.
Steps
1. Detect the language and available tooling:
- TypeScript/JavaScript: Use `tsc --noEmit` for unused locals, `eslint` with `no-unused-vars`.
- Python: Use `vulture` or `pyflakes` for dead code detection.
- Go: `go vet` reports unused variables; `staticcheck` finds dead code.
- Rust: Compiler warnings for dead code with `#[warn(dead_code)]`.
2. Scan for unused exports:
- Find all exported symbols.
- Search the codebase for imports of each symbol.
- Flag exports with zero import references (excluding entry points).
3. Detect unreachable code:
- Code after unconditional return/throw/break statements.
- Branches with impossible conditions (always true/false guards).
- Feature flags that are permanently enabled or disabled.
4. Find unused dependencies:
- Compare `package.json` dependencies against actual imports.
- Check for packages used only in removed code.
5. Present findings grouped by category with confidence levels. 6. Apply removals only for high-confidence dead code (no dynamic references). 7. Run tests after each removal batch to catch false positives.
Format
Dead Code Analysis
==================
Unused imports: <N>
- <file>:<line> - import { <symbol> } from '<module>'
Unused exports: <N>
- <file>:<line> - export <symbol> (0 references)
Unreachable code: <N>
- <file>:<lines> - <reason>
Unused dependencies: <N>
- <package> (last used: never / removed in <commit>)
Safe to remove: <N> items
Needs review: <N> itemsRules
- Never remove code that might be used via dynamic imports, reflection, or string references.
- Preserve exports that are part of a public API or SDK.
- Skip test utilities, fixtures, and development-only code.
- Run the full test suite after removing each batch to catch false positives.
- Log removed code with git commit messages for easy reversal.
The most comprehensive toolkit for Claude Code -- 135 agents, 35 curated skills (+400,000 via SkillKit), 42 commands, 176+ plugins, 20 hooks, 15 rules, 7 templates, 15 MCP configs, 26 companion apps, 53 ecosystem entries, and more.
Repo: rohitg00/awesome-claude-code-toolkit
Other commands on rohitg00-claude-code-toolkit.
- /adr
Write an Architecture Decision Record documenting a significant technical decision.
Open command - /design-review
Conduct a structured design review of a module, feature, or system component.
Open command - /diagram
Generate Mermaid diagrams from codebase analysis or description.
Open command - /migrate
Plan and execute a framework or library migration incrementally.
Open command - /plan
Create a structured implementation plan for the requested feature or change.
Open command - /refactor
Perform a systematic refactoring of the specified code area.
Open command

