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

review-guide.mdreferences/

Reviewing findings

Treat every finding as a candidate. Work through this list before recommending removal.

Quick checks per finding

  1. Search the whole repository, not only the scanned directory, for the name: other packages, scripts, docs, configuration files (pyproject.toml entry points, setup.cfg, YAML, JSON, templates).
  2. Look for dynamic access: getattr, importlib, globals(), plugin or registry patterns, serialization hooks, ORM or framework conventions that call methods by name.
  3. Check whether the symbol is public API of a library: a function nobody inside the repository calls may be used by downstream projects.
  4. For unused_import, check re-exports (from .x import y in an __init__.py without __all__) and imports kept for side effects.
  5. For unreachable_code, confirm the preceding return, raise, continue or break is unconditional in that block; the statement after it never runs.

Typical false positives

  • Methods called only through a framework (handle_<event>, visit_<Node>, on_<signal>): add a --whitelist pattern.
  • Names used only by code outside the scanned paths: scan a wider root.
  • Names referenced only from templates or configuration files.
  • Public API of a library meant for external callers.

Suggested order of cleanup

  1. Unreachable code (confidence 100): remove the dead statements.
  2. Unused imports (90): remove them one file at a time.
  3. Unused functions, classes, methods, variables (60): remove only after the checks above, one definition per commit, running the project tests after each.

After removal

Re-run the scanner on the same paths: removing a function can make its helpers unused in turn. Repeat until the output is stable or only whitelisted names remain.

SKILL.md

tile.json