Skip to main content
skill CX Codex

vulture-dead-code — Claude Code skill: find dead Python code

A skill that walks the agent through vulture and deadcode to find unused Python functions, classes, variables and imports. Useful when cleaning up a codebase.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add laurigates/claude-plugins --skill vulture-dead-code -a claude-code
Open on GitHub

What vulture-dead-code does

The skill covers two tools and when each one fits. Vulture runs static analysis and reports confidence scores from 60 to 100%, so you still filter some findings by hand. deadcode parses the AST, produces fewer false positives, and can flag unreachable code. Inside are comparison tables, ready-to-run commands, and pyproject.toml config samples for both.

Install either with uv add --dev vulture or uv add --dev deadcode. Vulture takes a --min-confidence threshold, glob excludes, and can emit a whitelist file of current findings. deadcode is configured in TOML and has a --dry-run mode that reports candidates without touching anything.

Heavy dynamic code — getattr, exec, decorators like @app.route — will make vulture flag live functions. Fill in ignore_decorators and ignore_names first, or your CI check turns into noise. The skill suggests deadcode for new projects with strict enforcement, and vulture at confidence 80 for large mature codebases.

What it helps with

  • find functions and classes nothing calls anymore
  • strip unused imports and variables before a release
  • generate a whitelist from current findings so later runs stay readable
  • catch unreachable code left after a big refactor
  • wire a dead code check into CI

Example prompts for the agent

  • run vulture over the project at confidence 80 and show me what it flags
  • generate a vulture whitelist and save it to a file
  • run deadcode with --show-unreachable and walk me through the dead branches

How to install vulture-dead-code

1Skills CLI (Vercel)

npx skills add laurigates/claude-plugins --skill vulture-dead-code -a claude-code

2Manually: put the files in place

~/.claude/skills/vulture-dead-code/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/vulture-dead-code/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about vulture-dead-code

How do I install vulture-dead-code in Claude?

Run npx skills add laurigates/claude-plugins --skill vulture-dead-code -a claude-code. The skill file then lives at ~/.claude/skills/vulture-dead-code/SKILL.md.

What does vulture-dead-code do?

It gives the agent instructions for two dead Python code detectors: vulture with confidence scores and deadcode on AST parsing. Commands, flags and config examples are included.

How is vulture different from deadcode?

Vulture is older and relies on confidence scores, so findings need filtering. deadcode is newer, parses the AST, has fewer false positives and can detect unreachable code.

Source text

SKILL.md · MIT
---
created: 2025-12-16
modified: 2026-05-09
reviewed: 2025-12-16
name: vulture-dead-code
description: Vulture and deadcode tools for detecting unused Python code (functions, classes, imports). Use when cleaning up codebases or removing dead code. Triggers vulture, deadcode.
user-invocable: false
allowed-tools: Bash, Read, Grep, Glob
---

# Vulture and deadcode - Dead Code Detection

Tools for finding unused Python code including functions, classes, variables, imports, and attributes.

## When to Use This Skill

| Use this skill when... | Use another tool instead when... |
|------------------------|----------------------------------|
| Detecting unused functions, classes, variables | Finding unused imports only (use `ruff --select F401`) |
| Cleaning up dead code in a codebase | Checking type correctness (use basedpyright) |
| Enforcing code hygiene in CI | Formatting code (use ruff format) |
| Generating whitelists for false positives | Running general linting (use ruff check) |

## Overview

**Vulture** (mature, confidence-based) and **deadcode** (newer, AST-based) both detect unused code but with different approaches:

| Feature | Vulture | deadcode |
|---------|---------|----------|
| **Approach** | Static analysis + confidence scores | AST-based detection |
| **Accuracy** | Confidence scores (60-100%) | High accuracy, fewer false positives |
| **Speed** | Fast | Very fast |
| **Configuration** | Whitelist files | TOML configuration |
| **Maturity** | Mature (2012) | Newer (2023+) |
| **Best For** | Large codebases, gradual cleanup | New projects, strict enforcement |

## Installation

```bash
# Install vulture
uv add --dev vulture

# Install deadcode (newer alternative)
uv add --dev deadcode

# Install both for comparison
uv add --dev vulture deadcode
```

## Vulture - Confidence-Based Detection

### Basic Usage

```bash
# Check entire project
vulture .

# Check specific files/directories
vulture src/ tests/

# Minimum confidence threshold (60-100%)
vulture --min-confidence 80 .

# Exclude patterns
vulture . --exclude "**/migrations/*,**/tests/*"

# Sort by confidence
vulture --sort-by-size .

# Generate whitelist of current issues
vulture . --make-whitelist > vulture_whitelist.py
```

### Configuration (pyproject.toml)

```toml
[tool.vulture]
min_confidence = 80
paths = ["src", "tests"]
exclude = [
    "**/migrations/*",
    "**/__pycache__/*",
    ".venv/*"
]
ignore_decorators = [
    "@app.route",
    "@pytest.fixture",
    "@property",
    "@staticmethod",
    "@classmethod"
]
ignore_names = [
    "test_*",
    "setUp*",
    "tearDown*",
]
```

## deadcode - AST-Based Detection

### Basic Usage

```bash
# Check entire project
deadcode .

# Check specific files/directories
deadcode src/

# Verbose output
deadcode --verbose .

# Dry run (show what would be removed)
deadcode --dry-run .

# Show unreachable code
deadcode --show-unreachable .

# Generate configuration
deadcode --init
```

### Configuration (pyproject.toml)

```toml
[tool.deadcode]
paths = ["src"]
exclude = [
    "tests/*",
    "**/__pycache__/*",
    "**/migrations/*",
]
ignore_names = [
    "test_*",
    "setUp",
    "tearDown",
    "main",
]
ignore_decorators = [
    "app.route",
    "pytest.fixture",
    "property",
    "staticmethod",
    "classmethod",
    "abstractmethod"
]
show_unreachable = false
```

## Choosing Between Tools

| Choose Vulture when... | Choose deadcode when... |
|------------------------|------------------------|
| Large, mature codebases | New projects |
| Need confidence-based filtering | Want fewer false positives |
| Need whitelist file approach | Prefer TOML configuration |
| Dynamic code (getattr, exec) | Need unreachable code detection |

### Hybrid Approach

```bash
# Run both for comprehensive detection
vulture --min-confidence 80 .
deadcode .
```

## Agentic Optimizations

| Context | Command |
|---------|---------|
| Quick vulture check | `vulture --min-confidence 90 .` |
| Quick deadcode check | `deadcode .` |
| Generate whitelist | `vulture . --make-whitelist > vulture_whitelist.py` |
| CI enforcement | `vulture --min-confidence 80 . vulture_whitelist.py` |
| Unreachable code | `deadcode --show-unreachable .` |
| Combined check | `vulture --min-confidence 80 . && deadcode .` |

## Quick Reference

### Vulture Flags

| Flag | Description |
|------|-------------|
| `--min-confidence N` | Minimum confidence (60-100%) |
| `--exclude PATTERN` | Exclude glob patterns |
| `--sort-by-size` | Sort results by size |
| `--make-whitelist` | Generate whitelist file |

### deadcode Flags

| Flag | Description |
|------|-------------|
| `--verbose` | Verbose output |
| `--dry-run` | Show without modifying |
| `--show-unreachable` | Detect unreachable code |
| `--init` | Generate configuration |
| `--strict` | Strict enforcement mode |

For detailed examples, advanced patterns, and best practices, see [REFERENCE.md](REFERENCE.md).

© laurigates · MIT · laurigates/claude-plugins

Similar skills

Everything for Code review and refactoring →

From the same set5

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor