dead-code-audit
Skill0 starsChanged 10 days agoApache-2.0View on GitHub
Audit a JavaScript/TypeScript repo for dead code with Knip, zero-install, and decide what is safe to remove: unused files, unused exports, unused exported types, unused dependencies and unlisted/undeclared dependencies, each categorized, with a before/after score (removable lines of code, unused-dependency count). Use when someone asks to find dead code, unused exports or unused dependencies, to detect unused code, run knip, or trouver du code mort. Every finding is a candidate: the skill flags likely false positives before anything is deleted. Needs Node (for npx/pnpm/yarn) and jq.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- abhijeetkakade1234/skillstheir own version, first seen Oct 28, 2026
- bmsuisse/skillstheir own version, first seen Oct 13, 2026
- matthewcsimpson/agentic-playbookstheir own version, first seen Jun 24, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- abhijeetkakade1234/skills★ 2same name
- bmsuisse/skills★ 2same name
- matthewcsimpson/agentic-playbooks★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository6 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- front-reviewSkill
- intakeSkill
- pr-guardianSkill
- pr-todoSkill
- sentry-triageSkill
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 49
Before you call anything removable, rule out the false positives Knip cannot see — do not auto-delete, and never run a bulk removal:
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Dead-code audit
Two steps. The script runs Knip and categorizes its findings deterministically — do not re-parse the JSON by hand. You add the judgment Knip cannot: which findings are false positives, and therefore what is actually safe to remove.
Step 1 — run the script
bash <skill-dir>/scripts/dead-code-audit.sh [<dir>] [--runner npx|pnpm|yarn]<skill-dir> is the directory holding this file. Map what the caller said to flags:
| Caller says | Flag |
| nothing, "this repo" | no argument — the current directory is audited |
| a path or sub-package | pass it as <dir> |
| "use pnpm / yarn", or detection picks the wrong one | --runner pnpm / --runner yarn |
The runner defaults to the lockfile (pnpm-lock.yaml -> pnpm, yarn.lock -> yarn, else
npx). Knip runs zero-install; if the repo has no Knip config the script says so and uses
Knip's defaults. Needs Node and jq. A medium repo takes 10 to 60 seconds. The script is
read-only — it deletes nothing.
What comes back
A header line, then one section per category — unused files, unused exports, unused exported types, unused dependencies, unlisted/undeclared dependencies — and a before/after score: removable lines of code (summed over the unused files) and the unused-dependency count. Category meanings and the score definition: reference.md.
Step 2 — apply the guardrails, then report
Knip reasons from static imports. Every line it prints is a candidate, not a verdict. Before you call anything removable, rule out the false positives Knip cannot see — do not auto-delete, and never run a bulk removal:
- Dynamic imports —
import(\./${name}`),require(variable)`, a glob loader: the target is referenced at runtime, never statically. Grep the repo for the base path. - Module Federation — anything under
exposes, aremoteEntry, orsharedin the bundler config is consumed by another app, not this build. Treat as used. - Framework entry points — route files,
pages//app/conventions,*.config.*, service workers, migration and seed scripts: run by the framework or a tool, not imported. - Referenced only in config — a file named in
tsconfig, a test matcher, a CI script or a package"bin"/"exports"map is used even with no import. - Public API re-exports — a package
indexre-exporting for external consumers looks unused inside the repo; check the package manifest'sexportsfield and who installs it.
For a candidate you cannot rule out, open the file at the reported line before deciding. Then report the categorized findings and the before/after score, and state plainly which candidates survived the guardrails (safe to remove) versus which need a human to confirm. The score is the ceiling — what Knip sees — not a promise that every line is dead.
Failures
The script exits non-zero with the cause on its last stderr line: jq missing, the
target is not a directory, Knip failed to run (Node absent, or the runner could not fetch
it), or Knip produced no parseable JSON. Relay that line and stop — never invent a report
or produce one from a partial run. A dead-code list that is wrong gets real code deleted.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

