remove-deadcode-py

remove-deadcode-py is a skill for Claude Code from YSAA1/harness-workflow. It costs 75 tokens per session (1,137 once invoked), scanned A, original, MIT.

A procedure for finding and removing unused code from Python projects. It combines lint tools, dead-code scanning, repository searches, and checks for dynamic or framework-based references.

In plain words
What is it for?
Use it to investigate unused imports, variables, functions, classes, and dependencies across a Python repository. It also checks entry points, plugins, routes, migrations, and other code that tools may miss.
Why use it?
Unused code can make a project harder to understand and maintain, but automated tools can wrongly flag code used indirectly. This process requires evidence before deletion and removes code in small batches.

Skill for Claude Code

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

Part of the harness-workflow plugin — 17 skills shipped together

Good fit Use it to investigate unused imports, variables, functions, classes, and dependencies across a Python repository. It also checks entry points, plugins, routes, migrations, and other code that tools may miss.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ysaa1/harness-workflow/remove-deadcode-py
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 YSAA1/harness-workflow --skill remove-deadcode-py
Clone the repo
git clone --depth 1 https://github.com/YSAA1/harness-workflow

Made for: Claude Code.

Or install harness-workflow, the plugin that ships this one along with the rest of its 17 skills.

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 remove-deadcode-py

README.md
[![agentmods](https://agentmods.dev/badge/skills/ysaa1/harness-workflow/remove-deadcode-py/github.svg)](https://agentmods.dev/skills/ysaa1/harness-workflow/remove-deadcode-py)
Your own site
<a href="https://agentmods.dev/skills/ysaa1/harness-workflow/remove-deadcode-py"><img src="https://agentmods.dev/badge/skills/ysaa1/harness-workflow/remove-deadcode-py/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for remove-deadcode-py

Your own site · 80×15
<a href="https://agentmods.dev/skills/ysaa1/harness-workflow/remove-deadcode-py"><img src="https://agentmods.dev/badge/skills/ysaa1/harness-workflow/remove-deadcode-py.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 75 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,137 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.00075 $0.01137
Opus 5.5 $0.00030 $0.00455
Sonnet 5.5 $0.00015 $0.00227
Haiku 4.5 $0.00007 $0.00114

Measured 27d ago against content hash 598fab999fd8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

remove-deadcode-py 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 27d ago.

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.

skills-en/remove-deadcode-py/SKILL.md · 52 lines

How it starts

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

Remove Dead Code (Python)

Delete unused code from Python projects. Detection relies on tools, conviction relies on evidence, deletion goes in small batches, and clearing everything in one pass is not the goal.

This skill is the on-demand entry for repo-wide cleanup and does not do task close-out (close-out goes through cleanup). The method is inspired by code-yeongyu/oh-my-openagent's remove-deadcode (no text copied); tool behavior defers to the official vulture/Ruff/deptry docs. Repo-wide scanning for non-Python ecosystems is out of scope for this skill: use knip for JS/TS, go tool deadcode for Go, and cargo-machete for Rust.

Workflow

  1. Pin down entry points (mark off the undeletable zone first): [project.scripts] and entry_points in pyproject.toml/setup.cfg, __main__.py, app.py/run.py/manage.py, conftest.py, Django models/admin/urls/migrations, Celery tasks, plugin registration points. Entry points and framework auto-discovery surfaces = undeletable.
  2. Fast lane: ruff check --select F401,F841 for unused imports/variables; with --fix, accept only safe fixes — F401 in __init__.py is re-export semantics (Ruff flags it as unsafe); do not delete by hand before confirming __all__. If deptry is installed, also run deptry . for unused dependencies.
  3. Main scan: vulture <src> --min-confidence 60. 60% (attributes/classes/functions) is only a lead; 90% (imports) can proceed to conviction; 100% (unreachable code) is mostly trustworthy but still goes through step 4.
  4. Conviction (triple evidence; missing any one downgrades to needs-review):
    • Zero references in a repo-wide grep — the scope covers source, strings, comments, config, docs, CI/workflows, Makefile/Dockerfile;
    • git log --follow <file> provenance: added for an abandoned feature, or long untouched, strengthens the call; recently active ones get downgraded;
    • Optional corroboration: never executed in test coverage (coverage report) ≠ dead code; it serves only as a bonus.
  5. Guard list (a hit means keep, no matter what the tool says):
    • Dynamic references reachable within the range of getattr / globals() / eval / exec / __import__ / importlib;
    • Registration decorators: @app.route, @router.*, @cli.command, @click.*, @pytest.fixture, @celery.task and custom registration decorators (grep the decorator definition site to confirm the registration mechanism);
    • Dunder methods, abstract-method/Protocol implementations, operator overloads, dataclass/Pydantic fields;
    • re-exports and __all__ in __init__.py;
    • Referenced by test files = a legitimate consumer;
    • Packaging-config references: include/packages in pyproject.toml, setup.cfg, MANIFEST.in.
  6. Batched atomic deletion: one module or one group of related symbols per batch; after each deletion run the project's narrowest tests + typecheck (if configured); commit only when green (the message states the evidence basis); on failure, git checkout -- <files> rolls back this batch, then shrink the batch size.
  7. Cascade rescan: after each finished batch, rerun vulture — deletions expose new dead code. Produce the report once all batches are done.

Read the full file on GitHub · 52 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. 27d ago Changed · -8 tokens per session 598fab999fd8
  2. 1mo ago First seen · 52 lines · 83 tokens per session scan A c9b4d5c66dd6

Subscribe to this mod's changes

remove-deadcode-py is a skill published in the GitHub repository YSAA1/harness-workflow (3 stars, last pushed 12d ago), licensed MIT. It adds 75 tokens to every session and 1,137 once invoked, about $0.0003 per session on Opus 5.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-17.

Related

Other skills, from other repositories

fastapi-templates

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

wshobson/agents · 37 tokens

temporal-python-testing

Test Temporal workflows with pytest, time-skipping, and mocking strategies. Covers unit testing, integration testing, replay testing, and local development setup. Use when implementing Temporal workflow tests or debugging test failures.

wshobson/agents · 45 tokens

prismer-python-debugpy

Debug Python: pdb REPL + debugpy remote (DAP).

Prismer-AI/PrismerCloud · 19 tokens

manimgl-best-practices

Trigger when: (1) User mentions "manimgl" or "ManimGL" or "3b1b manim", (2) Code contains from manimlib import , (3) User runs manimgl CLI commands, (4) Working with InteractiveScene, self.frame, self.embed(), ShowCreation(), or ManimGL-specific patterns. Best practices for ManimGL (Grant Sanderson's 3Blue1Brown…

calesthio/OpenMontage · 167 tokens

python-guidelines

This skill should be used when writing, reviewing, or refactoring Python code. Covers code integration, idiomatic patterns, docstring formatting, anti-abstraction rules, and software engineering basics.

fcakyon/claude-codex-settings · 42 tokens

datachain-core

Use ONLY for abstract DataChain SDK questions — API usage, method signatures, or code patterns — when no specific dataset or bucket is referenced. If the request mentions creating, saving, listing, exploring datasets or buckets, use datachain-knowledge instead.

datachain-ai/datachain · 54 tokens