Ask Claude to Hunt Down Dead Code
Codebases accumulate dead weight silently — functions nobody calls, exports nobody imports, CSS classes that exist in stylesheets but never appear in templates. Claude can track them down before they become a maintenance burden.
@src/ @resources/
Search for functions, classes, and components that are defined but never
imported or referenced anywhere in the codebase. List each one with the
file path and line number, and explain why you think it's unused.
Claude will scan for defined-but-never-called functions, unused exports, and unreferenced route handlers. It works across languages — JavaScript, TypeScript, PHP, Python, Ruby — and is equally effective at spotting CSS classes that exist in your stylesheet but don't appear in any template.
Dead code found:
- src/utils/formatCurrency.js:12 — formatCurrencyLegacy() defined but never imported
- src/components/OldModal.jsx — entire file never referenced in any route or layout
- resources/css/app.css:204 — .btn-ghost class not found in any Blade/JSX template
- app/Services/LegacyPaymentService.php:34 — class never instantiated
For larger codebases, scope it to one module at a time to stay within context limits — or combine it with your IDE's "find usages" output and paste the results to give Claude a head start.
Ask Claude to double-check each finding before deleting anything, since some code may be called dynamically (via call_user_func, require(), string-based dispatch, or reflection).
Dead code isn't harmless — it confuses contributors and hides real logic. Let Claude clean house.
Log in to leave a comment.
Set up Claude Code as an automated reviewer in your CI pipeline — on every pull request, it reads the diff, checks for bugs, security issues, missing tests, and convention violations, then posts its findings as a PR comment. Your human reviewers get a head start because the obvious issues are already flagged before they look.
Before deploying, tell Claude to read your project — migrations, environment variables, queue workers, scheduled tasks, caching, third-party integrations — and generate a deployment checklist that's specific to your app. Not a generic "did you run migrations?" list, but one that knows YOUR infrastructure and catches the things YOUR deploy can break.
Instead of writing a README from memory or copying a template, tell Claude to read your project and generate one that's actually accurate — real setup instructions from your config, real architecture from your directory structure, real API examples from your routes, and real prerequisites from your dependency files.