Dead Code Detector

Scan multi-language codebases for unused variables, orphaned functions, and unreachable code with severity ranking.

Install
cmdop skills install agensi-dead-code-detector

Dead Code Detector is a skill that performs static analysis across multi-language codebases to identify code that is no longer in use. It cross-references symbols across files rather than analyzing a single file in isolation, so it can confirm that a function or variable is genuinely unused anywhere in the project before flagging it.

The skill detects unused imports, variables, and private methods; orphaned functions, classes, and exported symbols; unreachable code paths following return or throw statements; leftover debugging statements such as console.log and debugger calls; and large commented-out code blocks.

Language support covers Python, JavaScript, TypeScript, Go, Rust, Java, and C/C++. The analysis is framework-aware: decorators used in Flask or Django and components registered in React or Vue are recognized as active usage, preventing false positives for common entry-point patterns. It also accounts for dynamic usage patterns such as reflection and dependency injection.

The multi-pass workflow validates findings against project-wide searches and handles framework-specific entry points before producing a severity-ranked report. Each finding is classified as either Safe to Remove or Verify Before Removal, giving developers a clear signal about which deletions are low-risk and which require manual review.

This skill is appropriate for codebases being refactored, audited before a release, or inherited by a new team. It is not a runtime profiler and does not detect performance bottlenecks or code that is only unreachable under specific runtime conditions.

Use cases

  • Identify unused imports and variables across an entire Python or TypeScript project before a major refactor
  • Find orphaned classes and exported symbols in a Go or Rust library that have accumulated over multiple releases
  • Locate leftover console.log and debugger statements in a JavaScript codebase ahead of a production deployment
  • Audit unreachable code paths after return or throw statements in Java or C/C++ services
  • Generate a severity-ranked dead code report for a React or Vue frontend that distinguishes safe deletions from ones needing manual review
  • Detect commented-out code blocks across a polyglot monorepo as part of a code-quality review

When to use it

  • Refactoring a multi-language codebase and need cross-file symbol analysis rather than single-file linting
  • Inheriting a legacy project and need a systematic inventory of unused code before making changes
  • Preparing a release and want to confirm no debug statements or orphaned logic remain
  • Working in a framework-heavy environment (Flask, Django, React, Vue) where decorator or component usage would cause naive tools to produce false positives

When not to use it

  • Need runtime profiling or analysis of code reachable only under specific execution conditions
  • Looking for security vulnerabilities or code quality issues beyond unused-code patterns
  • Project uses a language outside the supported set of Python, JavaScript, TypeScript, Go, Rust, Java, and C/C++
  • Need automated removal of dead code with version-controlled diffs — this skill produces a report, not automated edits