dead-code-finder
Skill0 starsChanged 9 days agoMITView on GitHub
Find dead code - unused functions, classes, variables, parameters and imports, unreachable code, commented-out code blocks and unused files - while accounting for reflection, public APIs, entry points and framework callbacks, which are reported as "possible" instead of "certain". Use when asked to find dead/unused/unreachable code, unused imports, leftover code or "what can I delete", in any language.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- thefrederiksen/devthrottletheir own version, first seen Nov 1, 2026
- navjyotnishant/nj-agentstheir own version, first seen Oct 15, 2026
- thefrederiksen/cc-directortheir own version, first seen Oct 8, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- thefrederiksen/cc-director★ 110same name
- thefrederiksen/devthrottle★ 110same name
- navjyotnishant/nj-agents★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository28 other files it gives its agents.
- accessibility-auditSkill
- api-design-reviewSkill
- architecture-reviewSkill
- complexity-checkSkill
- concurrency-reviewSkill
- config-reviewSkill
- cpp-google-styleSkill
- csharp-google-styleSkill
- dependency-auditSkill
- doc-comment-auditSkill
- error-handling-reviewSkill
- full-reviewSkill
- java-google-styleSkill
- logging-reviewSkill
- markdown-readme-google-styleSkill
- naming-reviewSkill
- owasp-security-reviewSkill
- performance-reviewSkill
- privacy-reviewSkill
- python-google-styleSkill
- regex-reviewSkill
- repo-hygieneSkill
- review-without-fixingSkill
- secrets-scanSkill
- shell-google-styleSkill
- sql-reviewSkill
- test-coverage-reviewSkill
- todo-auditSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
4
Distinctive
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
- Very specific: line 11
Check the files/directories the user names, otherwise the whole repo.
- Distinctive: line 14
Prefer existing tools if installed (never install them.
- Distinctive: line 20
Look for commented-out code (DD6) and unused files (DD7) separately: files that no other file imports/includes and that are no entry point.
- Distinctive: line 50
Every finding has a concrete location and evidence.
- Distinctive: line 53
Do not change code. Delete code only when the user explicitly asks for it, and then only "certain" findings unless told otherwise.
“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.
Files
Dead code finder
Review only: report candidates with a certainty level, never delete anything unless the user explicitly asks. Deleting code that is used dynamically breaks things at runtime, so certainty matters more than count.
Scope
Check the files/directories the user names, otherwise the whole repo. Skip .git/, build output, vendor/, node_modules/, .venv/, generated code. Always search for references across the whole repo, including non-code files (configs, templates, build files, docs), even when only a subdirectory is checked.
Steps
- Prefer existing tools if installed (never install them; say which one would help if none is found):
- Python:
vulture <dir> --min-confidence 80,ruff check --select F401,F841 - JS/TS:
knip,ts-prune, ESLintno-unused-vars,tsc --noUnusedLocals --noUnusedParameters - Java/Kotlin: IDE inspections, PMD
UnusedPrivateMethod; C#: analyzers IDE0051, IDE0052, IDE0060, CS0168 - C/C++:
-Wall -Wextra -Wunused,cppcheck --enable=unusedFunction; Go:staticcheck(U1000),deadcode; Rust: compilerdead_codewarnings
- Python:
- For each candidate, grep its name across the repo (also as a string, e.g.
"methodName",'ClassName') and check the exception list below before deciding the certainty. - Look for commented-out code (DD6) and unused files (DD7) separately: files that no other file imports/includes and that are no entry point.
- Report (format below).
Rules
- DD1 unused import/include/using
- DD2 unused local variable or parameter (parameters required by an interface/callback signature are fine)
- DD3 unused private/internal function, method, field, class or constant
- DD4 unused public/exported symbol - always "possible": external users may exist
- DD5 unreachable code: after
return/throw/break/continue/exit,if (false), conditions that are always true/false,catchfor exceptions that can't be thrown - DD6 commented-out code: blocks of ≥ 3 lines that are code, not explanation (git history keeps old code)
- DD7 unused file/module/asset: not imported, referenced or loaded anywhere and not an entry point
- DD8 obsolete feature flag / config option: always on or off, or the branch it guards is gone
- DD9 unused dependency → refer to the
dependency-auditskill
Certainty
- certain: private/local scope, no reference anywhere in the repo (code, strings, configs, templates), not on the exception list. Severity warning (DD5, DD6: warning; DD1, DD2: info).
- possible: anything on the exception list, any public/exported symbol, or a name that also appears as a string. Severity info.
Exceptions (never "certain"):
- Entry points:
main, CLI commands,__main__,package.jsonmain/bin/exports,__all__,setup.py/pyprojectentry points,Program.cs, scripts referenced in CI/Makefiles/Dockerfiles - Framework callbacks and conventions: Unity (
Start,Update,OnTriggerEnter…), Godot (_ready,_process,_on_*signal handlers connected in.tscn), Android/iOS lifecycle, JUnit/pytest/NUnit tests and fixtures, Spring/ASP.NET/Flask/Django routes and beans,__dunder__methods,toString/equals/hashCode, serialization hooks - Dynamic use: reflection, dependency injection,
getattr/importlib/eval,Class.forName, string-based event or message names, templates and bindings (HTML, XAML, Razor, Vue/Svelte templates) - C/C++: symbols exported from a library, macros, code inside
#if/#ifdeffor other platforms or configurations - Public library APIs and interface implementations
Report
In the user's language, grouped by file:
path/to/file:line - warning|info - <ID> <rule> - `name` - certain|possible - <evidence: "no reference found in repo" / "only referenced in comment" / reason it might still be used>- Every finding has a concrete location and evidence. Never claim "certain" without having searched the whole repo.
- Bulk hits (e.g. 40 unused imports): report once with count and 2-3 samples, suggest the tool/IDE action that removes them safely.
- End with a summary: findings per rule split into certain/possible, estimated removable lines, then the 3 safest cleanups to do first.
- Do not change code. Delete code only when the user explicitly asks for it, and then only "certain" findings unless told otherwise.
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.

