Audit Dead Code
Read-only hunt for dead and unused code via 4 analyzers (Knip TS/JS, vulture Python, gopls Go, grep shell/C#/other), adjudicated dead, uncertain, or alive…
от melodic-software★ 34 звезды на GitHub
Установить Audit Dead Code в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Audit dead code
Purpose
Find code nothing has touched in a long time, which a rotated tidying focus area and a diff-scoped simplification pass cannot see, and answer what here is no longer reachable, and how confident are we? Every candidate is adjudicated against the dynamic-usage patterns static analyzers miss, so the report is a list of decisions a human can act on, not an analyzer dump to re-verify.
The four analyzers are not peers
Present them as four analyzers of unequal strength, each labeled. A report that treats them as equals is wrong even when every finding in it is right.
| Analyzer | Covers | Measured character | How it fails |
|---|---|---|---|
| knip | TS/JS: unused files, exports, types, enum members. Not class members (Knip 6 rejects --include classMembers) |
60% precision / 100% recall on trap fixtures | Unrestored, it manufactures false positives (a failed config load produced 2 phantom "unused files"); its ERROR: line goes to stderr, which the JSON reporter discards |
| vulture | Python: unused function, class, method, variable, attribute, plus unreachable code | 16.7% precision / 100% recall; all five trap classes false-positived at 100% | Low precision by construction. Its output is a worklist, never a verdict |
| gopls | Go: unexported symbols only (gopls check -severity=hint), the analyzer's declared coverage |
Correct on every measured symbol; 2.1s | An unresolved module graph suppresses hints: false negatives, the opposite of knip. Never describe the two degradations with one phrase |
| grep | Shell and PowerShell functions; function/class/const/let/var declarations in JS/TS no package.json root owns (ts-unreferenced-symbol); C# type declarations and members with an access modifier, read as text and never built (cs-unreferenced-private, cs-unreferenced-symbol); unreferenced source files (unreferenced-file) |
Shell symbols: 4/4 true positives, 0 false over 546 .sh files (shellcheck found 0 of the 4). JS/TS symbols: 75% precision / 100% recall (derived 2026-11-28 from the candidate set the scan test asserts, not a separate scan). C# private: 66.7% / 66.7%; other C#: 33.3% / 100% (2026-10-29). unreferenced-file precision unmeasured |
Low recall: $, -, . are non-word characters, so an adjacent hit reads as a reference and saves a possibly dead symbol. A JS/TS export only an entry point or outside consumer calls is a false candidate; a name in a comment saves a dead one. A C# member reached by a computed reflection name, assembly scanning or a serializer is a false candidate |
Every figure comes from this plugin's trap fixtures under evals/fixtures/, as recorded on
2026-08-23 (JS/TS symbol figures derived 2026-11-28 from scripts/dead-code-scan.test.sh's asserted candidates, C# figures 2026-10-29). Recheck trigger: a major
version bump in any analyzer's detector, or a change to the fixture corpus. Re-measure before quoting
one to a user.
Orphaned files. The grep analyzer emits unreferenced-file (tier 2) for a source file no other
tracked file names, C# and languages with no analyzer (Rust, F# and VB among them) included. A reference in a CI
workflow, settings file, manifest or doc saves the file; a computed path or glob does not, so the
candidate is uncertain, not dead. Its input set, the no-analyzer extension list, per-analyzer
invocation, coverage accounting and degradation detail: context/analyzers.md
"Analyzer reference".
Candidate shapes and default tiers
The detector emits candidates, not verdicts. A shape's tier is its prior, taken from the measured precision of the analyzer that produced it.
| Shape | Analyzer | Default tier |
|---|---|---|
ts-unused-file |
knip | 2 |
ts-unused-export |
knip | 2 |
ts-unused-type |
knip | 2 |
ts-unused-enum-member |
knip | 2 |
py-unused-symbol |
vulture | 2 |
py-unreachable |
vulture | 1 |
go-unused-unexported |
gopls | 1 |
unreferenced-symbol |
grep | 1 |
ts-unreferenced-symbol |
grep | 2 |
cs-unreferenced-private |
grep | 2 |
cs-unreferenced-symbol |
grep | 2 |
unreferenced-file |
grep | 2 |
detector-drift |
any | 3 |
ts-unreferenced-symbol is tier 2, unlike the shell unreferenced-symbol, because its derived
precision is 3 of 4 and an entry point or public export nothing in the repository calls reads as
unreferenced. Both C# shapes are tier 2 because each yields a false dead on the trap fixtures.
A consumer's own CLAUDE.md or rules may refine these defaults.
Running the detector
${CL
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
- 01
Bash(${CLAUDE_SKILL_DIR}/scripts/dead-code-scan.sh:*) - 02
Bash(git grep:*) - 03
Bash(git log:*) - 04
Bash(grep:*)
Вложенные файлы
- context/adjudication.md
- context/analyzers.md
- evals/evals.json
- scripts/dead-code-scan-json-fixtures.test.sh
- scripts/dead-code-scan.sh
- scripts/dead-code-scan.test.sh
- scripts/lib/dead-code-shapes.sh
FAQ
Что делает скилл Audit Dead Code?
Read-only hunt for dead and unused code via 4 analyzers (Knip TS/JS, vulture Python, gopls Go, grep shell/C#/other), adjudicated dead, uncertain, or alive. Use when: 'find dead code', 'remove unused code', unused exports, functions, orphaned files, or if anything calls a symbol. Find-and-delete starts here; deleting is /code-tidying:tidy.
Как установить скилл Audit Dead Code?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Audit Dead Code запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…