CtrlK
BlogDocsLog inGet started
Tessl Logo
PluginPublic

trysac/dead-code-finder

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.

Quality

97%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Passed

No findings from the security scan

Overview
Quality
Evals
Security
Files

SKILL.md

name:
dead-code-finder
description:
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.

Dead code finder

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.

When to use

  • The user asks which functions, classes, methods or imports are unused.
  • Before a refactor or release, to list removal candidates in a package.
  • To check a pull request did not leave unreachable statements behind.

Steps

  1. 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.

  2. Run the bundled scanner:

    python scripts/dead_code_scan.py src --min-confidence 60

    Add --json for machine-readable output and --whitelist 'name_*' (repeatable) for names that must never be reported, such as plugin hooks.

  3. 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.

  4. 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.

  5. Report the candidates grouped by confidence, say which ones were checked, and only edit files when the user asks.

Exit codes

0 no findings at or above --min-confidence, 1 findings, 2 usage, path or read error.

Scope

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.

SKILL.md

tile.json