- Home
- Skills
- Code Quality & Review
- Dead Code Finder Pro: Remove Unused Python Code Safely
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.
$5
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 asking: “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 asking: “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 asking: “Scan the source folder for unused imports and classes, then show me a diff.”
Dead Code Finder Pro: Remove Unused Python Code Safely
Example session with this skill installed
I want to clean up my Python project. Can you find any code that isn't being used and show me what can be safely removed?
- Read your context and instructions
- Compiled the dead code finder
I will scan your Python project to find and confirm code that is no longer in use. I'll start by identifying candidates and then check for any hidden dependencies.
1. Finding Candidates
I have scanned the source directory and found the following items that appear to be unused:
- Unused Import:
import osinmain.py(High confidence) - Unused Function:
calculate_legacy_tax()inutils/finance.py(Medium confidence) - Unused Variable:
buffer_sizeinnetwork/client.py(High confidence)
2. Confirming Safety
After searching the entire project tree
import os: Safe to remove. No references found inmain.py.calculate_legacy_tax(): Needs review. The name appears in a commented-out section oftests/old_tests.py.buffer_size: Safe to remove. No other files reference this variable.
3. Proposed Changes
Here is the diff for the safe removals
# main.py
- import os
# network/client.py
- buffer_size = 1024
Would you like me to apply these changes now, or would you like to review the calculate_legacy_tax function first?
Connects securely to your tools. The creator never sees your data.
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
- Your AI agent scans your Python source files to find unused code and gives each find a confidence score.
- It searches your entire project for those names to confirm if they are truly safe to delete.
- You review the list of candidates and choose which ones you want to get rid of.
- The skill shows you exactly what will change and, with your permission, deletes the dead code.
- 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.
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.
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
- 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 buying a skill.
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
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 1 day ago
- Software
Python 3.10+
Permissions
What's inside
Frequently Asked Questions
New in Code Quality & Review
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Code Quality & Review.