Index of every page on this site: llms.txt
All skills
adityaarakeri avatar

/dead-code-audit

@468f6a1
Run it yourself

Thoroughly find dead, unused, and unreachable code in a repository and produce a confidence-ranked report. Use this skill whenever the user asks to find dead code, unused variables, unused functions or classes, unreachable code, orphaned files, unused exports, unused dependencies, stale CI files, orphaned config files, or temp/junk files, or wants to "clean up" or "slim down" a codebase. Also trigger on phrases like "what can I safely delete", "audit this repo", "find code nobody calls", or "our repo has gotten bloated". Works on repos of any size: it measures the repo first and automatically switches between a full one-pass scan, a tool-driven scan, or a chunked module-by-module strategy for very large codebases. Never delete code with this skill unless the user explicitly confirms deletions.

  • 11 files
  • 46.2 KB
  • Updated 3 months ago
  • GitHub
Use this Skill: https://skilld.dev/gh/adityaarakeri/senior-agent-skills/dead-code-audit

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

README.md

≈695 tokens on demand. Your agent reads this file only when SKILL.md points to it.

dead-code-audit

A Claude skill that hunts down dead code in a repository and hands back a confidence-ranked report instead of a reckless delete list.

Why the tiered report

Static analysis can only prove that nothing statically points at a piece of code. Reflection, dependency injection, and string-based dispatch all call code that looks orphaned on paper. So findings land in three tiers: safe to remove, probably dead (check with an owner), and unused but intentional (public API, feature flags). Nothing gets deleted unless you ask after seeing the report.

How it handles big repos

The skill measures the repo first (scripts/size_repo.py) and picks a strategy:

  • SMALL, under 50k lines: one full pass, every finding verified
  • MEDIUM, 50k to 500k lines: repo-wide tool scan, deep verification only on the candidates worth the effort
  • LARGE, 500k+ lines or 5k+ files: chunked module-by-module sweep. It builds a cheap global symbol index once (scripts/symbol_index.py), audits one module at a time, and checks every candidate against the global index so a helper used only by a distant module never gets flagged. Findings checkpoint after each chunk, so an interrupted audit resumes instead of restarting.

Vendored, generated, and build directories are excluded up front.

Running the scripts yourself

Both scripts are plain Python 3, standard library only.

# size a repo and get the recommended strategy
python scripts/size_repo.py ~/code/my-repo
python scripts/size_repo.py ~/code/my-repo --json   # machine-readable

# build the global symbol index (large repos)
python scripts/symbol_index.py ~/code/my-repo --out index.json

# quick reference count for one symbol
python scripts/symbol_index.py ~/code/my-repo --lookup process_payment

Layout

dead-code-audit/
├── SKILL.md                     # the workflow Claude follows
├── scripts/
│   ├── size_repo.py             # repo measurement + strategy pick
│   └── symbol_index.py          # global symbol index + reference lookup
└── references/
    ├── python.md                # vulture, pyflakes, deptry, Python traps
    ├── javascript.md            # knip, ts-prune, depcheck, JS/TS traps
    ├── go-rust-java.md          # deadcode, staticcheck, cargo-machete, PMD
    └── manual-analysis.md       # grep-and-git fallback when tools are missing

Supported languages

First-class: Python, JavaScript/TypeScript, Go, Rust. Covered with caveats: Java/Kotlin (reflection and Spring DI make automated certainty impossible, so the skill leans on the manual method plus IDE inspections there). Anything else falls back to the manual analysis method, which works on any text-based language.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 468f6a1. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 3 months ago

README badge

README badge for adityaarakeri/senior-agent-skills/dead-code-audit