/code:dead-codefrom code
Finds and removes unused code, files, exports, and dependencies using detectors (knip, vulture, deadcode, cargo-machete, OpenRewrite) or zero-reference grep. Every removal includes evidence; uncertain items are left for human review.
Ships in code. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Delete code nothing uses. Dead code costs reading time, review time and build time, and it misleads: a reader assumes it matters. A wrong deletion costs more than a missed one, so every removal carries evidence, and anything a tool cannot see into stays.
Resolve <plugin-root> first: in Claude Code use ${CLAUDE_PLUGIN_ROOT}; in Codex use the plugin root that contains this skills/dead-code/SKILL.md file. The script below needs Python 3.9 or later.
unattended: passed by callers such as burn. An unattended run asks the user nothing. Every question it would have asked becomes a queued finding instead (see Report).Analyze reachability from the program's entry points, not one symbol at a time. Whole-graph analysis finds chains of code that only dead code calls; Meta's SCARF removed about 50% more once it switched to it (https://engineering.fb.com/2023/10/24/data-infrastructure/automating-dead-code-cleanup/). Find the detectors the project already has:
python3 <plugin-root>/scripts/dead_code.py --root . detect
detect recognizes these and prints their commands:
--production, which also reports code that only tests use;deadcode -test for Go, with -whylive to show why a symbol it keeps is alive;RemoveUnused* recipes for Java, through the Maven rewrite plugin.The baseline must pass: if the build or tests fail before any change, stop and report it, because this skill never fixes a broken build. Never install a detector or add it to the project's dependencies: an interactive run asks first, and an unattended run queues the suggestion and falls back to the method below.
Without a detector, list candidates from the language server's find-references, or by reading the scope for definitions, and check each one with a repo-wide grep that includes string matches:
python3 <plugin-root>/scripts/dead_code.py --root . refs <symbol> --definition <file>:<line>
refs greps tracked files for the symbol as a whole word, string matches included, leaves out the definition, and splits the rest into code and tests. Its verdict is unreferenced, test-only or referenced. A string match counts as a reference until you have read it and shown it names something else.
A detector that reports live code as dead usually lacks an entry point or a framework plugin. Fix its configuration first: entry files, workspaces, framework plugins. Record a genuine exception in the tool's own allowlist (knip config, vulture whitelist, cargo-machete metadata), never in this skill and never as a suppression comment (https://knip.dev/guides/handling-issues). In an unattended run, configuration changes go in their own commit, so a reviewer can judge them apart from the deletions.
refs says unreferenced.refs says test-only.Remove only high candidates on your own. Code that only tests use counts as dead together with its tests, as in Google's Sensenmann (https://testing.googleblog.com/2023/04/sensenmann-code-deletion-at-scale.html), but deleting tests needs approval: an interactive run asks, and an unattended run queues the finding. Medium and low candidates are questions for the user in an interactive run and queued findings in an unattended one.
Remove in this order: whole files, then exports and symbols, then dependencies. Removing a file can orphan the exports it used, and removing code can orphan a dependency, so rerun the detector after each pass and stop when it finds nothing new.
After each batch, run the build, the type checker and the tests. A batch that fails any of them is reverted and recorded with the failing output. Do not try a smaller batch or a different fix: move on.
Commit once per category: files, exports and symbols, dependencies, and configuration. Each message says why the code is dead, such as "no references outside its definition" or "knip reports the dependency unused". Follow the repository's commit conventions.
Never do any of these:
refs reports as referenced without reading every match;Report in the terminal, or return to the caller when unattended:
refs output;An unattended run also returns its queued findings as task text the caller can append to .llm/todo.md: medium and low candidates, tests that only exercise dead code, and detectors worth adding. Each finding names the file, the symbol and the evidence.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Python, Go, Rust, Java, TypeScript, JavaScript
dead-code, unused-code, code-cleanup, tree-shaking, refactoring
npx claudepluginhub motlin/claude-code-plugins --plugin code12 skills in this plugin
/build-warningsMake a build quiet by fixing the causes of the warnings it prints, one class at a time, with before and after counts from the same command as evidence. Covers compiler, linter and deprecation warnings, runtime warnings printed during tests, slow-test reports, and stray noise such as debug prints and unsilenced logs. Use when the user asks to clean up build or test warnings, deprecations, or noisy output, or when a caller such as burn runs it unattended./cliCLI guidelines. Use whenever using the Bash tool, which is almost always. Also use when you see "command not found: __zoxide_z" errors./code-generationFormatting rules for Java code generators that build source code via string concatenation. Use when the user asks to "fix formatter-off", "fix code generation formatting", "fix auto-formatted string concatenation", or "add formatter off", and proactively when writing, reviewing, or modifying a code generation method./code-qualityCode quality guidelines. ALWAYS use skill for ANY code changes./docs-driftFind documentation that disagrees with the code, such as renamed paths, missing recipes, stale versions and outdated behavior claims, apply only mechanical one-to-one fixes, and propose the rest. Use when the user asks to check, audit or fix docs, READMEs, CLAUDE.md, AGENTS.md or SKILL.md files against the code, or to find stale or broken documentation, or when a caller such as burn runs it unattended./markdown-authoringWrite merge-friendly Markdown. Use when writing or editing Markdown files.Other plugins' skills for the same job