Purpose
Find code nothing has touched in a long time, which a rotated tidying lane 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 lanes are not peers
Present them as four lanes of unequal strength, each labeled. A report that treats them as equals
is wrong even when every finding in it is right.
| Lane | 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 lane'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: 66.7% precision / 66.7% recall (as recorded 2026-09-29). 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 2026-09-29, C# figures 2026-10-29). Recheck trigger: a major
version bump in any lane's detector, or a change to the fixture corpus. Re-measure before quoting
one to a user.
Orphaned files. The grep lane emits unreferenced-file (tier 2) for a source file no other
tracked file names, C# and languages with no lane (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-lane extension list, per-lane
invocation, coverage accounting and degradation detail: context/lanes.md
"Lane 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 lane that produced it.
| Shape | Lane | 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 measured
precision is 2 of 3 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
${CLAUDE_SKILL_DIR}/scripts/dead-code-scan.sh # whole repo, every lane
${CLAUDE_SKILL_DIR}/scripts/dead-code-scan.sh --max 20 # cap the adjudication set
${CLAUDE_SKILL_DIR}/scripts/dead-code-scan.sh --lane grep src/ # one lane, scoped candidates
${CLAUDE_SKILL_DIR}/scripts/dead-code-scan.sh --root <root> # another repository's root
${CLAUDE_SKILL_DIR}/scripts/dead-code-scan.sh --help # usage and exit codes
Exit is 0 on every scan path and 2 only on a usage error; no detector's exit code is propagated.
Present the Lane: lines with the findings: they make a clean report a claim rather than an
absence. A target narrows which files produce candidates; the reference search stays
repository-wide, because a reference from anywhere saves a symbol.
Over several repositories
With no target form, the scan covers this checkout, as it always has. A target form (--repo,
--repos-from, --owner, --fleet, --skip, or the same request in words) selects several
repositories, which resolve, count, fan out and merge as