Skip to content
Development
Command

/remove-dead-code

Safely remove identified dead code from the codebase.

From plugin
rohitg00-claude-code-toolkit
2.5k199 skills138 agents199 commands
Install
$ npx -y skills add rohitg00/awesome-claude-code-toolkit --agent claude-code

How 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/remove-dead-code

Context preview

What this command does when you run it.

Safely remove identified dead code from the codebase.

Command definition

remove-dead-code.md

/remove-dead-code - Remove Dead Code

Safely remove identified dead code from the codebase.

Steps

1. Load the dead code report from the most recent analysis 2. Filter to high-confidence items only (unless user requests medium/low) 3. Group removals by file to minimize file operations 4. For each file, identify the dead code segments to remove 5. Check for side effects: does the dead code initialize anything or register handlers 6. Remove unused imports that result from removing dead code 7. Remove empty files if all exports are unused 8. Clean up empty directories if all files are removed 9. Run the project's linter to verify no new errors are introduced 10. Run the test suite to confirm nothing breaks 11. Generate a summary: files modified, lines removed, items removed 12. Create a git-friendly diff for review before committing

Rules

  • Only remove items flagged as high-confidence unless explicitly told otherwise
  • Verify each removal does not break the build before proceeding to the next
  • Keep a backup list of all removed items for potential restoration
  • Do not remove code that has TODO or FIXME comments attached
  • Remove associated tests only if the user explicitly requests it
  • Process removals incrementally: one file at a time with validation
  • Stop immediately if any test fails and report the causing removal
Ships withrohitg00-claude-code-toolkit

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.

Get the whole plugin