- Home
- Skills
- Code Quality & Review
- dead-code-detector
More screenshots
Works with the AI Agents you already use
Dead Code Detector
Find unused imports, functions, variables, unreachable code and leftover debug statements across Python, JS/TS, Go, Rust, Java and C++, ranked by severity.
Free
dead-code-detector
Example session with this skill installed
"Scan my Python project for dead code"
- Read your context and instructions
- Compiled the dead-code-detector
"Dead Code Report — src/ (142 files scanned)
Critical — Safe to Remove (8):
File Line Type Symbol Confidence
──────────────────────── ───── ─────────────── ──────────────────────── ──────────
src/utils.py 12 Unused import from collections import HIGH
OrderedDict
src/api/handlers.py 45 Unused function legacy_endpoint() HIGH
src/models/old_schema.py 1-180 Dead module entire file not imported HIGH
Warning — Verify Before Removal (3):
File Line Type Symbol Confidence
──────────── ──── ─────────────── ──────────────── ─────────────────────────────────
src/auth.py 78 Unused function oauth_callback() MEDIUM (used via route decorator)
src/utils.py 92 Unused variable temp_config MEDIUM (referenced in tests only)
Info — Code Smells (5):
File Line Type Symbol Confidence
──────────── ──── ─────────────── ────────────── ──────────
src/debug.py 5 Debug statement print('debug')
Connects securely to your tools. The creator never sees your data.
About this skill
The Problem
Your Python project has 47 unused imports scattered across 23 files. Three functions haven't been called since the last refactor. There's a console.log('here') statement that made it through three code reviews. None of it breaks anything, all of it adds noise, and none of it will ever get cleaned up unless something forces it — because "it works" is the most dangerous phrase in software maintenance.
What You Get
- Multi-language detection — scans Python, JavaScript/TypeScript, Go, Rust, Java, and C/C++ with language-specific analysis (AST parsing for Python, type analysis for TS, compiler lint output for Rust)
- Unused import identification — finds imports that are never referenced, excluding type-only imports, side-effect imports, and dynamic usage patterns
- Dead function/class detection — locates functions and classes with zero references project-wide, accounting for framework conventions (decorators, route definitions, test discovery, dependency injection)
- Unreachable code detection — flags code after return, raise, break, continue, sys.exit(), and panic statements
- Debugging statement scanner — identifies console.log, debugger, print statements, and commented-out code blocks
- Confidence-scored report — categorizes findings as HIGH (provably unused), MEDIUM (unused in source but referenced in tests/docs), or LOW (dynamic usage possible) with removal recommendations
Why This Beats Prompting It Yourself
You can ask "find unused code" for a single file. But dead code accumulates across the entire codebase, in patterns that require project-wide cross-referencing — a function that looks unused might be called by a test, a decorator, or a dynamic dispatch. This skill performs the full cross-reference analysis with framework awareness, producing a report where every finding includes a confidence rating and specific removal guidance. Manual grep can't distinguish "unused" from "used via reflection."
Example Session
You: "Scan my Python project for dead code"
Agent: "Dead Code Report — src/ (142 files scanned)
Critical — Safe to Remove (8):
File Line Type Symbol Confidence
──────────────────────── ───── ─────────────── ──────────────────────── ──────────
src/utils.py 12 Unused import from collections import HIGH
OrderedDict
src/api/handlers.py 45 Unused function legacy_endpoint() HIGH
src/models/old_schema.py 1-180 Dead module entire file not imported HIGH
Warning — Verify Before Removal (3):
File Line Type Symbol Confidence
──────────── ──── ─────────────── ──────────────── ─────────────────────────────────
src/auth.py 78 Unused function oauth_callback() MEDIUM (used via route decorator)
src/utils.py 92 Unused variable temp_config MEDIUM (referenced in tests only)
Info — Code Smells (5):
File Line Type Symbol Confidence
──────────── ──── ─────────────── ────────────── ──────────
src/debug.py 5 Debug statement print('debug') HIGH
Summary: 16 dead code items found. 8 safe to remove immediately. 3 require manual verification. 5 code smells to clean up."
Use Cases
- Pre-release cleanup to reduce codebase bloat and cognitive load
- Code review gate to flag dead code introduced in PRs
- CI/CD quality gate to prevent dead code accumulation over time
- Post-migration cleanup after large feature removals or rewrites
- Onboarding audit to understand which parts of a legacy codebase are actually used
Known Limitations
Dynamic usage patterns (reflection, eval, getattr, dependency injection) produce false positives that are flagged as LOW confidence but may require manual verification. Framework-specific patterns like Django @app.route or React component registration need the full codebase context to avoid false removals. This skill does not remove code — it produces a report with removal recommendations.
Dynamic usage patterns (reflection, eval, getattr, dependency injection) produce false positives that are flagged as LOW confidence but may require manual verification. Framework-specific patterns like Django @app.route or React component registration need the full codebase context to avoid false removals. This skill does not remove code — it produces a report with removal recommendations.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
4 uses
Times used to date
Free forever
No account required to browse
Trust & safety
Security scan
Security scan passed 5 months ago
- Free with an Agensi account
Requires
Permissions
No special permissions declared or detected