Find dead code across the repo and plan its removal
Category: Cleanup · Updated 2026-09-22 · Tools: Both
Use this on a repo that's accumulated cruft over time — old feature flags left on, functions nobody calls anymore, files that stopped being imported months ago. Best done as a planning pass first, since static analysis alone can miss dynamic calls (reflection, string-based dispatch, config-driven loading). Medium usage, scales with repo size.
Full prompt
Search this repository for dead code: functions, classes, and exports that are never referenced anywhere else in the codebase, and files that are never imported by anything. For each candidate, note how you confirmed it looks unused (grep for the symbol name, check for dynamic/string-based references, check if it's a public API surface that external code might call). Rate your confidence as high/medium/low — low confidence for anything that could plausibly be called dynamically, used only in tests, or be part of a public interface. Produce a removal plan grouped by confidence level, without deleting anything yet. Wait for me to confirm which confidence tier(s) to actually remove, then do the removal on a new branch, running the full test suite after each deletion batch, and don't push.
Tips
- Insist on the confidence rating — without it, an agent will often flag something as dead that's actually invoked dynamically or from outside the repo
- Review the high-confidence tier first and let the agent proceed with just that before touching medium/low
- Running tests after each deletion batch, not just at the end, makes it obvious which specific removal broke something
Still waiting on a reset? See what to do when you hit the limit, or check Codex / Claude time since last reset.
Back to the prompt library · Subscribe: all-products feed