dead-code-funeral
Skill7 starsChanged 4 days agoMITView on GitHub
Finds dead code (unused files, functions and exports), holds a funeral with a gravestone card, and deletes only what the user approves. Use when asked to find dead code, never-imported files, what is safe to delete, or to clean up legacy code.
In this repository71 other files it gives its agents.
- docs/llms.txtllms.txt
- a11y-fixerSkill
- ad-copy-generatorSkill
- agent-guardrailsSkill
- agent-memory-keeperSkill
- ai-slop-detectorSkill
- api-to-sdkSkill
- app-store-optimizerSkill
- architecture-doctorSkill
- brand-voice-guideSkill
- bug-detectiveSkill
- bus-factorSkill
- changelog-from-gitSkill
- codebase-explainerSkill
- codebase-time-machineSkill
- codebase-valuationSkill
- commit-craftSkill
- commit-roastSkill
- competitor-spySkill
- content-repurposerSkill
- copy-paste-detectorSkill
- cost-cutterSkill
- demo-recorderSkill
- dependency-doctorSkill
- dependency-weigh-inSkill
- dev-wrappedSkill
- dockerize-anythingSkill
- domain-modelerSkill
- durable-agent-workflowsSkill
- e2e-flow-testerSkill
- email-campaign-writerSkill
- env-secrets-guardSkill
- gh-actions-auditorSkill
- github-portfolioSkill
- hook-generatorSkill
- incident-commanderSkill
- influencer-outreachSkill
- instagram-growth-managerSkill
- issue-triageSkill
- landing-page-roasterSkill
- launch-post-writerSkill
- meeting-notes-to-ticketsSkill
- merge-conflict-resolverSkill
- migration-wizardSkill
- name-checkerSkill
- plan-grillerSkill
- pre-commit-setupSkill
- prompt-injection-scannerSkill
- pr-reviewer-proSkill
- readme-glow-upSkill
- repo-cardSkill
- repo-dietSkill
- roast-my-githubSkill
- screenshot-to-componentSkill
- seo-blog-writerSkill
- skill-creator-proSkill
- skill-finderSkill
- skills-doctorSkill
- social-analytics-reporterSkill
- social-media-calendarSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
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
- Distinctive: line 8
Every repo has code nobody calls: the old parser, the v1 endpoint, the helper written for a feature that never shipped.
- Distinctive: line 55
Don't invent history or motives.
- Distinctive: line 60
Delete in batches of related items.
- Distinctive: line 61
After each batch, run the project's tests plus its type checker, linter or build where it has them.
- Very specific: line 62
Commit each passing batch on its own, for example chore: remove unused legacy parser and render_v1, with the deleted line count in the body.
- Distinctive: line 71
Delete or comment out anything the user hasn't approved by item or by group.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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.
Files
Dead Code Funeral
Every repo has code nobody calls: the old parser, the v1 endpoint, the helper written for a feature that never shipped. This skill finds it, says a few words over it, and deletes only what the user signs off on.
1. Run the scan
python3 scripts/find_dead.py # ranked list, obituaries, totals
python3 scripts/find_dead.py -C path/to/repo --top 50
python3 scripts/find_dead.py --json > dead.json # every item, every spared entry point
python3 scripts/find_dead.py --svg funeral.svg # gravestone card, totals only
python3 scripts/find_dead.py --svg funeral.svg --no-credit # same card without the small "made with agent-skills" line
python3 scripts/find_dead.py --svg funeral.svg --show-paths --now 2026-01-31The script only reads. It covers tracked Python files and the JavaScript/TypeScript family (.js .jsx .ts .tsx .mjs .cjs .mts .cts).
| Confidence | Meaning |
| high | a file no other file imports, and its path or module name appears nowhere else |
| medium | a top-level Python function or class, or an exported JS/TS symbol, that no other code names |
| low | as above, but the name shows up in strings or non-code files, or a decorator may register it |
Entry points are never reported. That covers files named like main, index, cli or __main__, scripts with a shebang or a __main__ block, tests and fixtures, config files, files that package.json or a module:function entry point in pyproject.toml points at, file-based routes (pages/, routes/, Next.js app/ route files, SvelteKit + files), and Django modules such as models.py, admin.py and migrations/. --json lists every spared file under entry_points with the reason.
Dates come from git. A file is born in the commit that added it (renames are followed) and last touched in its newest commit; a symbol's dates are its oldest and newest surviving lines in git blame. Tests count as callers, so code that only tests use is not reported.
Exit codes: 0 nothing found · 1 dead code found · 2 not a git repository, no commits, or bad arguments.
2. Verify before the funeral
The scan matches names, not bindings. The JS/TS side uses regular expressions, so it misses computed import() paths and path aliases other than @/ and ~/. Treat every item as a suspect and run git grep -n "<name>" on it. Look for these escape routes:
| Escape route | What to look for |
| Dynamic loading | importlib.import_module, __import__, require(variable), import() with a template string |
| Reflection | getattr, dispatch tables keyed by strings, plugin registries |
| Framework wiring | Django settings strings such as INSTALLED_APPS, Celery autodiscovery, pytest plugins, route folders in a custom place, custom bundler resolve rules |
| Build and CI | Makefiles, Dockerfiles, workflow YAML, shell scripts |
| Public API | when the report says the repo looks like a published library, exports and __all__ entries may have callers outside the repo |
Drop the items that turn out to be alive and mark the ones you cannot settle as undecided. A low item stays on the list with the mention that saved it. Read that mention before you suggest deleting it.
3. Hold the funeral
Open with the headline totals. Then give each verified item a short eulogy, highest confidence first. Every fact in it comes from the script: the path, the two dates, the line count and the zero callers. The humour has to come from those facts too:
utils/legacy_parser.py (2019-03-04 to 2023-11-02, 212 lines). Outlived by 0 callers. It spent its last three years waiting for an import that never came.
Don't invent history or motives. Don't name authors. If the user wants the card, give the SVG path.
4. Bury only what the user approves
- Show a numbered list grouped by confidence and ask which to delete ("all high", "1, 3, 5", "none").
- Delete in batches of related items. Removing a symbol includes the imports it leaves unused. Removing a file can include its stale mentions in docs or config when the user agrees.
- After each batch, run the project's tests plus its type checker, linter or build where it has them. If anything fails, restore the batch and report what broke.
- Commit each passing batch on its own, for example
chore: remove unused legacy parser and render_v1, with the deleted line count in the body. - Re-run the scan. Deleting code can remove the last caller of something else, so a second round may appear. Offer it instead of starting it.
Report
Give the headline totals by confidence and the verified list with obituaries. Say what you dropped as alive and why, and list the undecided items. After a deletion, add the commits, the lines removed and the test results.
Do not
- Delete or comment out anything the user hasn't approved by item or by group.
- Change a published library's public API before the user agrees, even when nothing in the repo uses it.
- Present the scan as proof. It is a list of suspects until step 2 is done.
- Make up facts for the funeral, or name the people who wrote the code.
- Mix deletions with refactors or formatting in the same commit.
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
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.

