python-dead-code

Detect and remove unused Python code with vulture and ruff.

6|2|Updated Jan 6, 2026
One-click install
npx skills add https://github.com/acaprino/anvil-toolset --skill python-dead-code
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-dead-code
Source: https://github.com/acaprino/anvil-toolset/tree/main/plugins/python-development/skills/python-dead-code
Command: npx skills add https://github.com/acaprino/anvil-toolset --skill python-dead-code

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires vulture, ruff, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps developers identify and remove dead or unused code in Python projects, improving code quality, reducing maintenance overhead, and preventing potential bugs.

Core Features & Use Cases

  • Detects Unused Code: Identifies unused imports, variables, functions, and classes.
  • Framework Aware: Handles false positives common in frameworks like Django, FastAPI, and pytest.
  • CI/CD Integration: Easily integrates into GitHub Actions or pre-commit hooks for automated checks.
  • Use Case: Before deploying a new version of your Python application, use this Skill to ensure no leftover, unused code is present, making the codebase cleaner and more efficient.

Quick Start

Use the python-dead-code skill to scan the current directory for unused Python code.

Frequently Asked Questions about python-dead-code

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find and remove unused Python code in my project?

To find and remove unused Python code, you can scan your project directory to detect unused imports, variables, functions, and classes using static analysis tools like vulture and ruff. This process identifies dead code to improve overall code quality and reduce maintenance overhead.

What is the best way to detect dead code in a Django or FastAPI application?

The best way to detect dead code in Django or FastAPI applications is using a scanning tool that provides framework-aware false positive handling. This ensures that framework-specific patterns like decorators or route injections are not incorrectly flagged as unused functions or variables.

Can I automate Python dead code detection in CI/CD pipelines and pre-commit hooks?

Yes, you can automate Python dead code detection by integrating scanning tools into GitHub Actions CI/CD pipelines and pre-commit hooks. This establishes automated code hygiene checks to ensure no unused imports or functions are deployed.

Does ruff work with vulture for Python linting and refactoring?

Ruff works with vulture to perform Python linting and refactoring by combining their detection capabilities. Using both tools together provides comprehensive identification of unused imports, variables, and dead code for effective project cleanup.

Why does my Python dead code scanner report false positives for pytest fixtures?

Python dead code scanners often report false positives for pytest fixtures because testing frameworks dynamically reference functions and variables. Framework-aware false positive handling specifically filters out these testing library patterns to prevent incorrect dead code flags.