agentleFS
yeaight7yeaight7/agent-powerups/skills/dead-code-removal/SKILL.md

dead-code-removal

Skill6 starsChanged 4 months agoApache-2.0View on GitHub

Use when unused functions, classes, exports, or files need to be identified and safely deleted.

2 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

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Verify unused — search the entire repository: Do not assume code is dead just because the current file doesn't use it:

    line 23
  2. Distinctive:

    If there is any doubt, leave it alone or ask the user.

    line 39
  3. Distinctive:

    Prune dependencies: If you delete the only code that was using an imported module, remove the import statement as well.

    line 43
  4. Very specific:

    Run tests: Always run tests and/or type checkers (e.g., tsc --noEmit) after removal to ensure you didn't accidentally break a hidden …

    line 45

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

Purpose

Dead code increases maintenance overhead and confuses developers. Verify a symbol is truly unused across the entire repository, then delete it outright — never comment it out.

When to Use

  • A symbol, file, or export looks unused
  • A feature removal or migration left orphaned helpers behind
  • A coverage or lint report flags unreachable code

Inputs

  • The candidate symbols/files to remove
  • The repo's test and type-check commands

Workflow

  1. Verify unused — search the entire repository. Do not assume code is dead just because the current file doesn't use it:

    grep -rn "symbolName" . --include="*.ts" --include="*.tsx"    # all references
    grep -rn "from ['\"].*module-name" src/                       # import sites
    git log -3 --oneline -- path/to/suspect-file                  # recent touches

    Ecosystem tools can shortcut the inventory when available (e.g., knip or ts-prune for TypeScript exports, vulture for Python).

  2. Check for dynamic invocation. Be wary of dynamically invoked code — reflection, dependency injection by string name, ORM mappers, route tables, config-driven dispatch:

    grep -rn "\"symbolName\"\|'symbolName'" .    # string-keyed references

    If there is any doubt, leave it alone or ask the user.

  3. Delete aggressively. Once confirmed unused, delete the code. Do not comment it out.
  4. Prune dependencies. If you delete the only code that was using an imported module, remove the import statement as well.
  5. Run tests. Always run tests and/or type checkers (e.g., tsc --noEmit) after removal to ensure you didn't accidentally break a hidden dependency.

Output

  • The deletion diff plus, per removed symbol, the search evidence that it was unused

Verification

  • Whole-repo search performed per symbol — including string-keyed/dynamic references
  • No commented-out code left behind
  • Orphaned imports pruned along with the dead code
  • Tests and type checker green after removal

Failure Modes

  • Current-file blindness — "this file doesn't use it" is not "the repo doesn't use it".
  • Dynamic-invocation casualties — reflection/DI/ORM references don't appear as imports; search string keys too.
  • Commenting instead of deleting — commented-out code is still dead code; git history already preserves 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.

Reviews can't be read right now.

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.