Code Quality Tool

Dead Code Detector

Find unused exports across your codebase. Scan JavaScript, TypeScript, and Python projects for exported symbols that nobody imports.

Get the CLI Tool

Run the dead code detector locally as an MCP server, or try it online below.

npx @clinetools/dead-code-detector
Requires Node.js 18+
  • Finds unused functions, classes, variables, types, interfaces, enums
  • Supports JavaScript, TypeScript, and Python
  • Cross-file import analysis — tracks where exports are used
  • Skips node_modules, dist, .git, and other common ignored dirs
  • Zero config — just run with npx

How to Use It

Three ways to find dead code — pick the one that fits your workflow.

1

Try Online

Explore the interactive demo below to see dead code detection in action on sample projects.

2

Use via CLI

Run as a local MCP server and connect any MCP-compatible client.

npx @clinetools/dead-code-detector
3

Add to Cline / Claude Code

Add the tool to your MCP settings for instant access from your AI assistant.

"dead-code": { "command": "npx", "args": ["@clinetools/dead-code-detector"] }

MCP Client Configuration

{
  "mcpServers": {
    "dead-code-detector": {
      "command": "npx",
      "args": ["@clinetools/dead-code-detector"]
    }
  }
}

Example: Scan a Project

// Prompt to your AI agent:
"Find all unused exports in my src/ directory"

// The agent calls:
find_dead_code({ path: "src/" })

// Output:
{
  "summary": {
    "filesScanned": 24,
    "totalExports": 47,
    "unusedExports": 8,
    "usageRate": "83%"
  },
  "potentiallyUnused": [
    { "name": "formatDate", "type": "function", "file": "utils/dates.ts", "line": 12 },
    { "name": "OldUserModel", "type": "class", "file": "models/user.ts", "line": 45 }
  ]
}

Example: Clean Up Before Release

// Prompt to your AI agent:
"Scan the project for dead code and remove anything
that's clearly unused. Be conservative — skip
anything that might be used dynamically."

// The agent scans, reviews each result,
// and safely removes confirmed dead exports.
Live Demo

Try It Online

Select a sample project to see which exports are used and which are dead code.

Select a project above

Analysis Results

Why Dead Code Matters

Unused code isn't just clutter — it actively slows you down and creates risk.

Larger Bundle Sizes

Tree-shaking can't remove everything. Unused exports that have side effects, circular dependencies, or dynamic access patterns survive bundling and bloat your deployment.

Maintenance Burden

Every unused function is code you still have to read, understand, and maintain. When refactoring, dead code creates false dependencies that make changes harder and riskier.

Hidden Vulnerabilities

Dead code with outdated dependencies or vulnerable patterns sits unpatched because nobody thinks to update it. An attacker who finds a way to invoke it gets a free exploit.

Onboarding Friction

New team members waste time understanding code that's never called. Dead code looks intentional in a codebase — there's no way to know it's unused without tooling.

Test Waste

Tests for unused code consume CI time and create false confidence in coverage metrics. Removing dead code and its tests makes your suite faster and your coverage numbers honest.

Need Automated Dead Code Cleanup?

Our Pro plan includes scheduled scans with PR generation that safely removes confirmed dead code.

View Plans