Find dead Python code (unused imports, functions, classes, methods, variables, unreachable statements) with confidence scores. Use when the user asks to find, audit or clean up unused or dead code in a Python project.
97%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Name-based whole-program analysis of Python source with ast. The code is parsed, never imported or executed. Needs only Python 3.10+ and the standard library.
Pick the paths to scan (a package directory or .py files). Prefer source directories; scan tests together with the source so test-only usage counts as a reference.
Run the bundled scanner:
python scripts/dead_code_scan.py src --min-confidence 60Add --json for machine-readable output and --whitelist 'name_*' (repeatable) for names that must never be reported, such as plugin hooks.
Read each finding as module:line: kind 'name' (confidence%). Confidence is fixed per kind: 100 unreachable code, 90 unused import, 60 unused function, class, method or variable. See rules.
Check findings before acting on them, using the review guide. A finding is a candidate, not proof: names used only through getattr, entry points, framework registration or other languages are not seen.
Report the candidates grouped by confidence, say which ones were checked, and only edit files when the user asks.
0 no findings at or above --min-confidence, 1 findings, 2 usage, path or read error.
Python source files only. Analysis is by name across the scanned set: any attribute access x.m keeps every method called m, and a string equal to an identifier counts as a reference. Files over 1,000,000 bytes, non-UTF-8 files and files with syntax errors are listed under errors and skipped.
repository in the plugin manifest, or publish from a GitHub Action to verify it.