agentleFS
doivamongdoivamong/agent-workbench/.claude/skills/awb-dead-code-audit/SKILL.md

awb-dead-code-audit

Skill2 starsChanged 6 months agoMITView on GitHub

WHAT: find genuinely unused code with a false-positive gate — a symbol is reported "dead" only when several INDEPENDENT cross-checks all come back empty, never on one finder's say-so. USE WHEN: an on-request cleanup sweep ("find dead / unused code", "what can we delete", a post-refactor or pre-release prune, "is this function called anywhere?"). DO NOT TRIGGER: "this function is too long / too complex" (a structural-size concern, not deadness); hunting for bugs (a review/debug skill); deleting code the user already named as dead.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    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:

    If any check is non-empty, it is not dead — drop it and say why.

    line 52

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “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

Dead-code audit (false-positive gated)

Announce on activation: "Using awb-dead-code-audit — cross-checking before calling anything dead."

Finding candidates is easy; the hard part is not being wrong, because a confidently-wrong "this is dead" deletes something reached dynamically and breaks production.

Scope

  • Does: propose deletion candidates, try hard to disprove each one's deadness, and present only the survivors — with evidence — for a human to delete.
  • Does NOT: auto-delete anything (ever), judge code quality/length, or claim certainty. Static reachability is undecidable under dynamic dispatch; this is a high-confidence filter, not a proof.

Why one finder isn't enough

A symbol can be reached with no literal call site: dynamic dispatch (getattr, a handler registry, plugin discovery), string/declarative references (templates, config, serialization, route/ORM decorators, CLI entry points), an external/public-API surface, or framework hooks (fixtures, signal handlers). A grep that finds zero call sites found zero literal ones — not zero uses.

Reader-dead is not feature-dead

A symbol with no live reader can still have a live writer. A scheduled task, cron job, or ETL step may keep populating a table or file that nothing reads any more — so deleting the dead reader leaves the producer running, accruing orphaned data silently. When you audit a feature for removal (not just a single symbol), trace the write side too: who still produces this, and is a scheduler / cron registration keeping it alive? A dead reader is one signal, never the whole verdict.

Process

  1. Gather candidates from the language's unused-symbol finder (or grep). This is the input, not the answer.
  2. HARD GATE: a candidate is "dead" only when ALL of these are empty —
    • the symbol name across the whole repo (incl. tests, scripts, docs);
    • the name as a string (dynamic dispatch / templates / config / serialization);
    • entry points & registries (CLI, routes, plugins, decorators, __all__, settings);
    • the external surface (exported? part of a public API or webhook?). If any check is non-empty, it is not dead — drop it and say why.
  3. Report, don't delete. Present survivors with the four empty checks as evidence; the human decides. Deletion is a separate, reviewed step.
  4. Delete in small, reversible batches (if asked) — one logical group per commit, suite green after each, so a wrong call is easy to bisect and revert.

Honesty / limits

Reachability under dynamic dispatch is undecidable in general — this reduces false positives, it does not eliminate them, and it never deletes. Absence of evidence (no grep hits) is not evidence of absence (no uses); a linter sees literal references only, so templates, getattr, registries, and external callers are invisible to it.

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.