agentleFS
PradnyeshpPradnyeshp/Claude-Skills/.claude/skills/dead-code/SKILL.md

dead-code

Skill2 starsChanged 4 months agoMITView on GitHub

Find unused code — unreferenced exports, functions, variables, imports, files, and dependencies — and propose safe removals. Use when the user says "find dead code", "what's unused", "remove unused imports", "find unreferenced functions", "what can I delete", or "clean up dead code".

7 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 5 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 5

    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
  1. Distinctive:

    Prefer a real analyzer when one exists: Use the language's dead-code tooling and report its output:

    line 21
  2. Distinctive:

    If no tool is installed, fall back to careful grep: for each exported symbol, search the codebase for references and flag those with none.

    line 26
  3. Distinctive:

    Don't delete in the discovery pass.

    line 49
  4. Distinctive:

    Treat unused dependencies separately — a package may be used only at runtime/build time or via a config the analyzer can't see.

    line 50
  5. Distinctive:

    If nothing is unused, say so plainly rather than padding the list.

    line 51

“Common” is measured: kept by at least 6 in 10 of the 4 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Stack & tooling signals

!ls package.json pyproject.toml Cargo.toml go.mod tsconfig.json 2>/dev/null

!ls node_modules/.bin/knip node_modules/.bin/ts-prune node_modules/.bin/depcheck 2>/dev/null

Instructions

Find dead (unused) code in this project, scoped to $ARGUMENTS if a path was given, and propose safe removals. Default to report-and-confirm, not silent deletion.

Method

  1. Prefer a real analyzer when one exists. Use the language's dead-code tooling and report its output:
    • JS/TS: knip, ts-prune, depcheck (unused deps), or eslint with no-unused-vars.
    • Python: vulture, or ruff/flake8 unused-import rules.
    • Rust: the compiler's dead_code / unused warnings (cargo build).
    • Go: go vet, staticcheck (U1000), deadcode.
    • If no tool is installed, fall back to careful grep: for each exported symbol, search the codebase for references and flag those with none.
  2. Verify before condemning. A symbol with zero internal references may still be a public API entry point, a framework hook (route handler, lifecycle method, CLI command), used via reflection/dynamic dispatch, or referenced in a string/config. Read the context and rule these out — don't flag what's reachable through a non-obvious path.
  3. Categorize findings: unused imports, unused local variables, unreferenced functions/classes, unreachable branches, orphaned files (imported by nothing), and unused dependencies.
  4. Rank by safety. Unused imports and locals are near-zero-risk; unreferenced exported functions and whole files need more scrutiny (could be public surface). Note the risk per item.

Output

Group findings by safety, each with a file:line and why it appears unused:

### Safe to remove — local scope
- `path:line` — unused import `foo`

### Likely dead — verify it's not public API
- `path:line` — exported `bar()` has no references in the repo

Then offer to delete the safe tier and let the user confirm the riskier ones.

Rules

  1. Report real, evidenced findings (file:line + tool output or the search that found nothing). Don't guess.
  2. Be conservative with anything exported or entry-point-like: public APIs, dynamically-referenced code, and framework-invoked functions are easy false positives — flag them as "verify", not "delete".
  3. Don't delete in the discovery pass. After the user confirms, removals should be done in small, behavior-preserving steps with tests run after.
  4. Treat unused dependencies separately — a package may be used only at runtime/build time or via a config the analyzer can't see.
  5. If nothing is unused, say so plainly rather than padding the list.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.