python-dead-code

python-dead-code is a skill for Claude Code from acaprino/daodan. It costs 61 tokens per session (2,539 once invoked), scanned A, original, MIT.

A Python dead-code checker that uses Ruff and Vulture to find unused imports, variables, functions, classes, and unreachable code.

In plain words
What is it for?
Use it to clean Python projects or add unused-code checks to CI, pre-commit hooks, and other automated checks.
Why use it?
It helps remove code that is no longer used while filtering common false alarms from frameworks such as Django, FastAPI, pytest, and Click.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the python-development plugin — 9 skills, 3 commands, 3 agents shipped together

Good fit Use it to clean Python projects or add unused-code checks to CI…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/acaprino/daodan/python-dead-code
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add acaprino/daodan --skill python-dead-code
Clone the repo
git clone --depth 1 https://github.com/acaprino/daodan

Made for: Claude Code.

Or install python-development, the plugin that ships this one along with the rest of its 9 skills, 3 commands, 3 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for python-dead-code

README.md
[![agentmods](https://agentmods.dev/badge/skills/acaprino/daodan/python-dead-code.svg)](https://agentmods.dev/skills/acaprino/daodan/python-dead-code)
Your own site
<a href="https://agentmods.dev/skills/acaprino/daodan/python-dead-code"><img src="https://agentmods.dev/badge/skills/acaprino/daodan/python-dead-code.svg" alt="Measured on agentmods" height="20"></a>
Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,539 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00061 $0.02539
Opus 5 $0.00030 $0.01269
Sonnet 5 $0.00012 $0.00508
Haiku 4.5 $0.00006 $0.00254

Measured yesterday against content hash 96fc7a1fd34b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

python-dead-code scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

exports/claude/plugins/python-development/skills/python-dead-code/SKILL.md · 403 lines

How it starts

The opening of the file, as written. The whole thing — 403 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Python Dead Code Detection

Detect and remove unused code in Python projects using vulture and ruff. Framework-aware analysis that distinguishes real dead code from convention-driven usage patterns.

Core Expertise

What it detects

  • Unused imports (ruff F401)
  • Unused variables (ruff F841)
  • Redefined-unused names (ruff F811)
  • Unused functions and classes (vulture)
  • Unreachable code after return/raise/break (vulture)

Key capabilities

  • Two-tool approach: ruff for fast lint-level checks, vulture for deeper analysis
  • Framework-aware false positive filtering
  • Confidence scoring (vulture --min-confidence)
  • Whitelist support for intentional exceptions
  • CI/CD integration (GitHub Actions, pre-commit)

Installation

# Using uv (recommended)
uv tool install vulture
uv tool install ruff

# Or via pip
pip install vulture ruff

# Verify installation
uv run vulture --version 2>/dev/null || vulture --version
uv run ruff --version 2>/dev/null || ruff --version

Basic Usage

Ruff (Fast Lint-Level Checks)

# Unused imports (F401)
ruff check [target] --select F401

# Unused variables (F841)
ruff check [target] --select F841

# Redefined unused names (F811)
ruff check [target] --select F811

# All unused-code rules together
ruff check [target] --select F401,F811,F841

# Auto-fix safe removals (imports only)
ruff check [target] --select F401 --fix

# Preview what would be fixed
ruff check [target] --select F401 --fix --diff

Vulture (Deep Unused Code Detection)

# Full scan with default confidence (60%)
vulture [target]

# Higher confidence -- fewer false positives (recommended)
vulture [target] --min-confidence 80

# Very high confidence -- only obvious dead code
vulture [target] --min-confidence 90

# Scan with whitelist
vulture [target] whitelist.py --min-confidence 80

# Exclude specific paths
vulture [target] --exclude "venv,__pycache__,.git,migrations"

# Sort by confidence (highest first)
vulture [target] --min-confidence 80 --sort-by-size

Read the full file on GitHub · 403 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 403 lines · 61 tokens per session scan A 96fc7a1fd34b

Subscribe to this mod's changes

python-dead-code is a skill published in the GitHub repository acaprino/daodan (8 stars, last pushed yesterday), licensed MIT. It adds 61 tokens to every session and 2,539 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-05.

Related

Other skills, from other repositories

python-code-quality

Code quality checks, linting, formatting, and type checking commands for the Agent Framework Python codebase. Use this when running checks, fixing lint errors, or troubleshooting CI failures.

microsoft/agent-framework · 40 tokens

plugin-architecture-patterns

Design, implement, or diagnose Xberg plugin traits, typed registries, priority collisions, lifecycle, native extractors, and Alef-generated Python plugin bridges. Load for plugin-system work, not ordinary extractor parsing.

xberg-io/xberg · 49 tokens

test-corpus

The testdocuments submodule is a bucket-fetched fixture corpus that is not committed. This skill covers readtestfixture, missing fixtures, valid A/B controls, and submodule push order. Load before running Rust tests on a fresh clone, setting up an A/B control, adding a fixture-backed test, or diagnosing…

xberg-io/xberg · 72 tokens

idapython

IDA Pro Python scripting for reverse engineering. Use when writing IDAPython scripts, analyzing binaries, working with IDA's API for disassembly, decompilation (Hex-Rays), type systems, cross-references, functions, segments, or any IDA database manipulation. Covers ida modules (50+), idautils iterators, and common…

mrexodia/ida-pro-mcp · 77 tokens

stack-trace-python-probe

Internal helper for meta-stack-trace-investigator. Use when a Python traceback needs Python-specific root-cause checks, pytest reproducer guidance, and defensive patch targets.

opensquilla/opensquilla · 40 tokens

python-debug-execution-911f17

Debug Python script execution failures by capturing full tracebacks and verifying working directory.

HKUDS/OpenSpace · 23 tokens