# Dead Code Finder Pro: Remove Unused Python Code Safely

> Find unused Python imports, functions, classes, methods and unreachable code, check each one against the whole project, then remove it with a reviewed diff.

Dead Code Finder Pro: Remove Unused Python Code Safely is a paid AI agent skill on Agensi by José Miguel Gómez, in Code Quality & Review. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $5 (one-time purchase)
- Creator: [José Miguel Gómez](https://www.agensi.io/creators/jose-miguel-gomez)
- Category: [Code Quality & Review](https://www.agensi.io/skills/code-quality-review)
- Version: 1.0
- Last updated: 2026-12-03
- Security: scan passed (2026-12-03); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/dead-code-finder-pro-remove-unused-python-code-safely
- Tags: code-review, python, refactoring, clean-code

## What it does

- Identifies unused functions, classes, and variables in Python projects
- Assigns confidence scores to findings to help you decide what to keep
- Searches the whole project for name matches to prevent breaking dynamic calls
- Generates a preview diff so you can see changes before they happen
- Removes dead code in a specific safety order to keep the project stable
- Produces a cleanup report summarizing everything that was deleted

## Who it's for

- **Founders maintaining their own app:** Clean up your codebase so it is easier to understand and cheaper to maintain. Try: "Find and remove any Python code in my app that isn't being used anymore."
- **Freelance Python developers:** Deliver cleaner, professional code to clients by pruning unused functions and variables. Try: "Audit this client project for dead code before I submit my final pull request."
- **Small engineering teams:** Shrink your project size and remove technical debt before a big release. Try: "Scan the source folder for unused imports and classes, then show me a diff."

## About this skill

When a project grows, it often ends up with "dead code" bits of logic, variables, or imports that are no longer used but still take up space. This skill helps your AI agent find these leftovers and safely remove them. It looks through your Python files to spot functions and classes that nothing calls, then double-checks the whole project to make sure they really aren't needed.

**How it works**
1. Your AI agent scans your Python source files to find unused code and gives each find a confidence score.
2. It searches your entire project for those names to confirm if they are truly safe to delete.
3. You review the list of candidates and choose which ones you want to get rid of.
4. The skill shows you exactly what will change and, with your permission, deletes the dead code.
5. Your AI agent runs a final check to ensure the project still works and looks for new dead code.

**What you get:** A cleaner, smaller Python project with all confirmed unused code safely removed.

## Requires

- Python 3.10+

## Known limitations

It only works on Python files. It cannot see if code is called by external libraries or other programming languages not included in the scan.

## Technical details

This skill uses three Python scripts (dead_code_scan.py, confirm_candidates.py, and remove_dead_code.py) built with Python 3.10+ standard library. It utilizes the ast module for static analysis without executing code. It generates JSON findings and markdown reports. It supports dry-runs for diff generation and requires explicit --apply flags for file writes. It includes framework-specific patterns and a confirmation playbook to handle dynamic name resolution.

## 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 Pro: Remove Unused Python Code Safely 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

### What does this skill actually do for my code?

This skill helps you find and delete parts of your Python project that are no longer used, such as functions, classes, and variables. It cleans up the code so your project is smaller and easier to manage without accidentally breaking things.

### What do I need to have ready before using this?

Your AI agent needs access to your Python source files and the scripts included in this skill. You should also have your project under version control, like Git, so you can safely review changes before they are finalized.

### How does it make sure it is not deleting something important?

The skill identifies candidates for removal and assigns them a confidence score. It then performs a search across your entire project to verify if those names appear in other files or configuration before providing a list of confirmed dead code for you to review.

### Are there any types of code this skill cannot find or handle?

The skill only works with Python source files and uses name-based analysis. It might not see code that is called by other programming languages or through dynamic lookups, which is why it includes a confirmation step for you to double check.

### What kind of report or results will I see?

You will receive a list of unused code candidates with evidence for removal and a preview of the changes. Once you approve, the skill updates your files and provides a cleanup report summarizing what was removed.

### How should I tell my AI agent to start the cleanup?

You can tell your AI agent to audit your project for dead code or ask it to prune unused functions and imports to clean up the source tree. It will then walk through the find, confirm, and remove process with you.

---

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.
