# Dead Code Finder

> Identify and remove unused variables, functions, exports, and orphan files across Python and JS/TS projects.

Dead Code Finder is a paid AI agent skill on Agensi by aingram702, in Code Quality & Review. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $1 (one-time purchase)
- Creator: [aingram702](https://www.agensi.io/creators/aingram702)
- Category: [Code Quality & Review](https://www.agensi.io/skills/code-quality-review)
- Version: 1.0
- Last updated: 2026-10-19
- Security: scan passed (2026-10-12); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/dead-code-finder
- Tags: code-review, testing, api, python, typescript, javascript, refactoring

## About this skill

Large codebases accumulate technical debt in the form of unused exports, variables, and orphan files that bloat bundles and confuse developers. This skill scans your project to identify dead code that can be safely deleted, assigning confidence scores to minimize the risk of breaking dynamic references.

### What it does
- **Python AST analysis** finds unused imports, local variables, and unreferenced functions or classes.
- **JS/TS tree shaking** identifies exported symbols that are never imported elsewhere in the project.
- **Orphan detection** flags entire files that have no inbound imports or references.
- **Framework awareness** respects entry points, test files, dunder methods, and React components used in JSX.
- **Confidence scoring** categorizes findings from high to low based on the risk of dynamic usage or reflection.

### How it works
1. **Define entry points** by specifying your main application files and public APIs to anchor the dependency graph.
2. **Execute scan** on the target directory using the analysis engine.
3. **Review findings** organized by confidence level and file location.
4. **Apply whitelists** to exclude legacy modules or third-party integrations that should remain untouched.

### Frameworks & tools
This skill supports Python, JavaScript, and TypeScript projects. It leverages AST parsing and dependency graph analysis to track symbols across modules.

### Why this beats prompting it yourself
Generic LLM prompts often miss the difference between a truly unused export and a dynamic reference hidden in a string or registry. This skill systematically builds a dependency tree, ensuring that "dead" code isn't actually a critical entry point or test utility.

### Use cases
- **Bundle optimization** by removing unreferenced JavaScript exports and orphan files.
- **Technical debt reduction** during major refactors or version migrations.
- **Codebase audits** to find legacy Python functions that are no longer part of any execution path.

### Known limitations
Dynamic features like `getattr`, reflection, or string-based imports can hide usage. Always run your test suite after performing deletions.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Dead Code Finder skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### How does the dead code finder differ from a standard linter?

This skill performs a comprehensive scan of your Python, JavaScript, and TypeScript files, identifying unused exports, orphan files, and unreferenced functions that bloat your codebase and increase technical debt.

### Can I exclude specific files or directories from being flagged as dead code?

Yes, the skill includes framework awareness for React and standard Python conventions, and it allows you to define custom entry points and whitelists to protect dynamic references or legacy modules.

### Is there a risk that this skill will identify active code as 'dead' if it's used dynamically?

While the skill utilizes AST analysis to find static references, dynamic features like reflection or string-based imports can hide usage; we recommend reviewing low-confidence findings and running your test suite after deletions.

### Which AI agents and environments are compatible with this skill?

This skill is designed for compatibility with leading AI agents that support file-system access and code analysis, enabling them to navigate your directory structure and parse dependency trees.

### What is included in the purchase of this skill?

You receive the full logic for Python and JS/TS analysis, pre-configured confidence scoring algorithms, and a guide on setting up entry points for your specific project architecture.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
