Skip to main content
Back to Vibe Coder Toolkit
Codebase

Dead Code

Find what you're maintaining for nothing

npx promptreports-cli dead-code

Finds stale API routes (180+ days), unused components, zombie dependencies. Delete with confidence.

dead-code finds the silent tax in your codebase. Stale API routes that nobody touched in 180+ days. Components that exist but aren't imported anywhere. Dependencies in package.json that aren't referenced in code. Each finding includes evidence (last modified date, import count) so you delete with confidence, not hope.

Prerequisites

  • app/api/ and components/ directories optional

Flags & Options

FlagDescriptionDefault
--routesCheck API routes only
--componentsCheck components only
--depsCheck dependencies only
--jsonJSON output

Examples

Full scan

npx promptreports-cli dead-code

Routes + components + deps.

Deps only

npx promptreports-cli dead-code --deps

Faster — just npm package check.

Routes quarterly

npx promptreports-cli dead-code --routes

Quarterly cleanup ritual.

Output

Three sections: stale routes, potentially unused components (with line count), zombie dependencies.

  STALE API ROUTES (not modified in 180+ days):
  - app/api/legacy/old-feature/route.ts    (modified 2024-08-03)
  - app/api/experiments/[id]/route.ts       (modified 2024-09-14)
  - app/api/beta/checkout/route.ts          (modified 2024-10-01)
  ... and 2 more

  POTENTIALLY UNUSED COMPONENTS:
  - components/OldDashboard.tsx      345 lines, 0 imports
  - components/ExperimentalUI.tsx    187 lines, 0 imports
  3 components, ~2,100 lines removable

  ZOMBIE DEPENDENCIES (in package.json but not in code):
  - lodash-es                  0 references
  - old-csv-library            0 references
  - @deprecated/chart-lib      0 references

What it reads and writes

Reads

  • app/api/**/route.ts
  • components/**/*.tsx
  • package.json
  • git log per file

Writes

Nothing (read-only)

Free vs Pro usage

Free tier

  • Quarterly cleanup rituals
  • Pre-acquisition codebase audit
  • Reduce bundle size by 20%+ on mature projects

Pro tier

Upgrade
  • Auto-PR to remove verified dead code
  • Usage tracking (is this route REALLY never called? check Vercel logs)
  • Cross-reference with analytics (PostHog feature flags)
  • Dead code dashboard — track accumulation over time

Pro tips

  • "Potentially" is key — always verify before deleting
  • A route with 0 git activity + 0 prod requests is safe to remove
  • Run after major refactors — you always leave dead weight behind
Free to try

Install the whole toolkit.

One command unlocks all 23 tools.