About prune-dead-code
A repository-wide code review skill for identifying dead declarations, duplicates, drifted literals, and unreachable limits. It verifies usage, reports findings for approval, and only then applies approved removals and runs checks.
Key features
- 01Searches four dead-code categories
- 02Verifies references across code and tests
- 03Classifies removal safety
- 04Reports findings before edits
- 05Updates tests and runs checks
Use cases
- 01Reviewing a repository before cleanup
- 02Finding duplicated constants and types
- 03Checking whether limits are reachable
- 04Removing approved unused declarations
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ lukeberrypi/ skills --skill prune-dead-codeAfter installing, type/prune-dead-codein Claude Code to confirm it loaded.
Details
From the project READMEPrune Dead Code
Treat every declaration as live until you have proven it safe to remove. Find candidates in four categories, verify each one across the whole repository, and report them all for approval before editing.
Categories
- Confirmed dead: symbols, constants, tokens, or barrel re-exports with zero references.
- Dedupe: the same constant, string, or type literal declared verbatim in two or more places.
- Drift: a magic literal that duplicates an existing named constant.
- Arbitrary limits: caps, thresholds, or timeouts guarding against situations users cannot reach. Quantify the real limit before recommending removal.
Workflow
- Search each category across the whole repository, code and tests alike.
- Verify every candidate's usage before judging it; one missed reference makes the verdict wrong.
- Classify each candidate as safe to remove or arbitrary but intentional.
- Report the table below.
- Ask which findings to apply before editing.
- Apply approved changes and update affected tests.
- Run typecheck, lint, and tests; fix anything the changes broke.
Required Output
Use exactly these columns:
| Item | Location | Notes |
|------|----------|-------|
| `<symbol>` | `path:line` | Zero references repo-wide (verified). Confirmed dead. |
| `<constant>` | `pathA:line`, `pathB:line` | Identical declaration in 2 files. Dedupe into one shared constant. |
| literal `<value>` | `path:line` | Duplicates `<NAMED_CONSTANT>`; reference the constant to avoid drift. |
| `<CAP>` | `path:line` | Threshold unreachable in practice (state the real limit). Safe to remove. |
- Item: Exact declaration in backticks, or a short phrase for inline literals.
- Location:
path:line; include every dedupe and drift location. - Notes: In one sentence, identify the item, confirm usage, and give the verdict.
Rules
When in doubt, it stays live — remove only what you have proven dead.
- A symbol used only in its own file may be unexported, not deleted; cross-file consumers require it to stay exported.
- Check tests before removing exports. Keep exports that cover non-trivial logic, or flag the trade-off.
- Keep intentional tuning values — animation timings, debounce intervals, sizes, minimums — and report them as arbitrary but intentional.
- Keep validation and guards that prevent crashes on corrupt or missing data.
- Treat uncertain dynamic access, reflection, constructed imports, public APIs, and framework entry points as live.
Comments
Markdown supported