agentleFS
tejastn10tejastn10/workbench/skills/quality/dead-code-sweep/SKILL.md

dead-code-sweep

Skill1 starsChanged 2 months agoMITView on GitHub

Repo-wide removal of code nothing calls — unused exports, unreachable branches, registered-but-never-invoked handlers, scaffolding for tech the stack doesn't run, commented-out blocks. Every removal proven with a grep. Use when asked to "remove dead code", "clean up the repo", after a big feature removal, or on a periodic tidy.

3 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

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

    Prove it before deleting: Every removal has a grep or a tool output showing zero references.

    line 29

“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.

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

Dead-code sweep

Repo-wide and deliberate — distinct from quality/deslopify, which only touches the current session's diff.

What counts as dead

  • Unused exports — exported symbol, zero importers. grep -rn "name" --include=… or the language tool (ts-prune, deadcode for Go, vulture for Python).
  • Unreachable branches — an if / case that can't be true given how the function is actually called. Trace the callers.
  • Registered but never invoked — an instrument, recorder, wrapper, listener, route, or job that's wired up and never fires. Give the grep that proves it: grep -rn "RecordServiceCall\|ServiceWrapper" pkg/ → no caller.
  • Scaffolding for absent tech — Kafka recorders when the stack is SQS, a dev env config when there's no dev env.
  • Commented-out code — delete, git remembers.
  • Dead dependencies — in the manifest, imported nowhere (depcheck, go mod tidy).
  • Orphaned files — a module nothing imports, a test for deleted code.

Rules

  • Prove it before deleting. Every removal has a grep or a tool output showing zero references. Paste it in the PR.
  • Watch for reflection / dynamic dispatch — DI containers, decorators, string keys, config-driven registries can "use" something grep won't show. Check.
  • Public API of a published package is not dead just because this repo doesn't call it — check downstream first.
  • One PR per coherent chunk, chore: remove dead <area>. Not one giant PR.
  • Latent-but-not-dead (a self-heal branch, a fallback) → leave it, it's not this skill's job.

Anti-patterns

  • ❌ Deleting on "looks unused" without the grep.
  • ❌ Missing a reflective/dynamic caller.
  • ❌ One 2000-line deletion PR nobody can review.
  • ❌ Removing a published package's exported API.

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.