Thoroughly find dead, unused, and unreachable code in a repository and produce a confidence-ranked report. Use this skill whenever the user asks to find dead code, unused variables, unused functions or classes, unreachable code, orphaned files, unused exports, unused dependencies, stale CI files, orphaned config files, or temp/junk files, or wants to "clean up" or "slim down" a codebase. Also trigger on phrases like "what can I safely delete", "audit this repo", "find code nobody calls", or "our repo has gotten bloated". Works on repos of any size: it measures the repo first and automatically switches between a full one-pass scan, a tool-driven scan, or a chunked module-by-module strategy for very large codebases. Never delete code with this skill unless the user explicitly confirms deletions.
Ships in senior-agent-skills. 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.
Read when SKILL.md points to them; scripts run unread.
Find code that nothing actually uses, without lying about certainty. The output is always a report with confidence tiers, never silent deletion.
Static analysis cannot prove code is dead. It can only prove nothing statically references it. Reflection, dependency injection, string-based imports, plugin registries, ORM magic, and template engines all call code that looks unreferenced. So every finding gets a confidence tier, and deletion only happens if the user asks for it after seeing the report.
Run the sizing script first. It counts files and lines per language, flags vendored and generated directories, and recommends a strategy.
python scripts/size_repo.py /path/to/repo
Strategy thresholds (the script applies these for you):
| Tier | Repo size | Strategy |
|---|---|---|
| SMALL | under 50k source lines | Full scan: run every relevant tool across the whole repo in one pass, then manually verify each finding |
| MEDIUM | 50k to 500k lines | Tool scan: run language tools repo-wide, but only do deep cross-reference verification on the highest-value candidates (largest files, whole modules, exported symbols) |
| LARGE | over 500k lines or over 5,000 source files | Chunked scan: see "Large repo protocol" below. Do not attempt a single-pass grep-everything approach, it will blow the time budget and the context window |
Always exclude before scanning, regardless of tier: node_modules, vendor,
dist, build, .git, target, venv/.venv, __pycache__, generated code
(protobuf _pb2 files, *.generated.*, migration folders unless asked), and
test fixtures. The sizing script prints an exclusion list; confirm it looks right
before proceeding.
Read the reference file for each language the sizing script found. Each one lists the tools, install commands, invocation, and known false-positive patterns:
references/python.md - vulture, pyflakes, coverage-assisted checksreferences/javascript.md - knip, ts-prune, depcheck, ESLint (covers TS too)references/go-rust-java.md - staticcheck/deadcode, cargo machinery, compiler flagsreferences/configs-ci-hygiene.md - temp/junk files, stale CI, orphaned configs.
ALWAYS read this one regardless of language; run python scripts/hygiene_scan.py <repo>
alongside the source-level tools, since source tools cannot see this category at all.references/safe-removal.md - test-only-alive detection, tombstone runtime
verification for Tier 2, the deletion workflow, and prevention (CI ratchets).
Read before reporting and always before deleting anything.If a tool is unavailable and cannot be installed (no network, unsupported), fall
back to the manual method in references/manual-analysis.md: build a symbol
definition list with grep/AST parsing, then search for references to each symbol.
For each candidate the tools flag, check the dynamic-usage traps before assigning a tier:
"symbol_name", 'symbol_name') -
catches reflection, getattr, dynamic imports, config-driven dispatch.__init__.py or index.ts, listed in __all__, mentioned in docs or
README, or the package is published. Public API that is internally unused is
"unused internally", not dead.git log --oneline -3 -- <file>. Code touched in the last
30 days deserves extra suspicion of the tools, not of the code.references/safe-removal.md.
Exception: published-library code may legitimately have only test references
internally; that stays Tier 3.ALWAYS use this exact structure:
# Dead Code Audit: <repo name>
Scanned: <N files, N lines> | Strategy: <SMALL/MEDIUM/LARGE> | Coverage: <full or which modules>
## Tier 1 - Safe to remove (high confidence)
Nothing references these statically OR dynamically. Private symbols, unreferenced
files, unreachable branches after return/raise, unused imports.
<table: location | symbol | why it is dead | evidence>
## Tier 2 - Probably dead (verify with owner)
Statically unreferenced but matches a dynamic-usage risk pattern, or is old code
in a rarely-touched module. For each item, offer the tombstone technique from
`references/safe-removal.md` (a logged marker shipped for 30-90 days) as the way
to settle it with runtime evidence instead of leaving it in limbo.
<table: location | symbol | risk that it is actually used | suggested verification>
## Tier 3 - Unused but intentional (do not remove without discussion)
Public API surface, feature-flagged code, platform-specific branches.
## Unused dependencies
Packages in the manifest that no source file imports.
## Stale CI, configs, and junk files
Temp/backup files, CI files for retired systems or nonexistent branches, and
configs for tools no longer in the dependency set.
## Not scanned
Anything excluded or skipped due to size limits, so the user knows the blind spots.
Estimate deletable line counts per tier. Note the standing blind spots when relevant: dead API endpoints need traffic logs and dead database objects need query logs, both outside a source-only audit; name them as follow-ups rather than staying silent.
If the user then asks to delete, follow the workflow in
references/safe-removal.md: Tier 1 only, one branch per audit and one commit
per module, tests deleted with the code they tested, a post-delete grep per
symbol, full test suite and build, and a diff summary. After a cleanup, offer
the prevention step from the same file (compiler/linter flags plus a baselined
ratchet job) so dead code stops accumulating between audits.
For LARGE repos, work like a search party sweeping a forest grid by grid rather than one person wandering everywhere:
python scripts/symbol_index.py /path/to/repo --out index.json
This is a flat map of defined symbols to files, built with lightweight parsing,
cheap enough to run on millions of lines.*.log, *.bak, .DS_Store, editor swaps)references/configs-ci-hygiene.md)README.md (opens in a new tab)references/configs-ci-hygiene.md (opens in a new tab)references/go-rust-java.md (opens in a new tab)references/javascript.md (opens in a new tab)references/manual-analysis.md (opens in a new tab)references/python.md (opens in a new tab)references/safe-removal.md (opens in a new tab)scripts/hygiene_scan.py (opens in a new tab)scripts/size_repo.py (opens in a new tab)scripts/symbol_index.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
10 skills in this plugin
/debug-protocolDiagnose bugs, failing tests, crashes, regressions, flaky behavior, and performance failures when the cause is unknown. Use for stack traces, wrong output, intermittent failures, environment mismatches, or repeated unsuccessful fixes. Do not use when the root cause is already established and the task is to implement the known fix; hand that work to tdd-loop./evaluate-ai-changesEvaluate changes to prompts, model or provider versions, RAG retrieval and ranking, tool schemas, agent policies, structured outputs, safety filters, and model routing. Use when AI-system quality, safety, latency, or cost may change. Do not use for ordinary deterministic code changes; use tdd-loop for those and combine both skills when an AI change also modifies deterministic adapters./git-hygieneExecute explicitly requested version-control mutations safely, including staging, commits, branches, merges, rebases, conflict resolution, undo operations, and pull-request preparation. Always use before force push, reset, clean, history rewrite, or deletion. Do not trigger for read-only status, diff, log, blame, or show requests that must leave repository state unchanged./plan-firstProduce and maintain an implementation plan for risky, ambiguous, irreversible, or coordinated changes, and whenever the user asks for a plan or approach. Trigger on public contracts, schemas, auth, payments, migrations, build or deployment systems, and material design choices. Do not use for low-risk mechanical work with an obvious established implementation./repo-reconMap an unfamiliar repository, service, or module before non-trivial work. Use when entering a codebase not explored in the current session, onboarding, tracing an unknown flow, or recovering from a wrong structural assumption. Do not use for a scoped, obvious change when the relevant files, commands, and conventions are already known./safe-refactorChange internal code structure while preserving observable behavior through small verified steps. Use for renames, extractions, moves, decomposition, and duplication removal when behavior must remain stable. Do not use for bug fixes, public contract changes, dependency or framework migrations, schema migrations, or other work expected to change compatibility or runtime behavior./senior-agent-skills:dead-code-auditfrom senior-agent-skills
senior-agent-skills@adityaarakeri is listed by adityaarakeri/astack — review the source before installing
npx claudepluginhub adityaarakeri/astack --plugin senior-agent-skills