remove-deadcode

A cautious procedure for finding and deleting code that is proven to be unused, including files, exports, functions, variables, and imports. It checks references, tests, re-exports, reflection, and framework entry points before removal.

In plain words
What is it for?
Use it to prune orphaned files, unused exports, functions, variables, and imports after a refactor or during code cleanup.
Why use it?
It reduces clutter left behind by refactors without assuming that an apparently unused symbol is safe to delete. Verification helps avoid breaking code that is reached indirectly.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/znlgis/my-opencode-deepseek-config/remove-deadcode
Any agent
npx skills add znlgis/my-opencode-deepseek-config --skill remove-deadcode
Clone the repo
git clone --depth 1 https://github.com/znlgis/my-opencode-deepseek-config

Made for: Claude Code, Codex.

Per session 92 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 763 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00092 $0.00763
Opus 5 $0.00046 $0.00381
Sonnet 5 $0.00018 $0.00153
Haiku 4.5 $0.00009 $0.00076

Measured 3d ago against content hash 20e7b123d8d9, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

remove-deadcode 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 3d 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.

opencode/skills/remove-deadcode/SKILL.md · 77 lines

How it starts

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

Remove Dead Code

Delete code that is provably unreferenced — without breaking anything. The rule is simple: prove it's dead before you delete it. A confident-looking unused symbol is often reached through a barrel export, a test, reflection, or a framework entry point. Verify first.

Phase 1: Scan (parallel)

Fire independent detectors at once and collect candidates:

  • Compiler / linter unused flags — e.g. TypeScript tsc --noUnusedLocals --noUnusedParameters, ESLint no-unused-vars, Go deadcode/staticcheck, Python vulture, Rust cargo +nightly udeps / dead-code warnings.
  • Orphaned files — source files not imported by any other file.
  • Unused exports — exported symbols never imported elsewhere.
  • LSP references — "find all references" returning only the definition.

Delegate broad searches to explore subagents in parallel when the codebase is large; keep each search scoped to one question.

Phase 2: Verify each candidate (before deleting)

For every candidate, confirm it is genuinely dead. Discard it (keep the code) if any of these is true:

  • It is re-exported through a barrel/index file that external code imports.
  • It is referenced by tests, fixtures, or snapshots.
  • It is a framework/tooling entry point (route handler, CLI command, migration, plugin hook, main, serializer) discovered by convention, not import.
  • It is reached by reflection, dynamic import, string key, or DI container.
  • It is part of a published public API (@public, exported package surface).

Re-run "find references" (LSP) immediately before each edit — the graph may have changed as you removed earlier items.

Phase 3: Delete in conflict-free batches

  • Group removals by file: everything in the same file goes in the same batch, so parallel edits never collide.
  • Remove the symbol/file and its now-unused imports.
  • Stage precisely: git add <specific files> — never git add -A.

Phase 4: Prove the removal is safe

After each batch:

Read the full file on GitHub · 77 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. 3d ago First seen · 77 lines · 92 tokens per session scan A 20e7b123d8d9

Subscribe to this mod's changes

remove-deadcode is a skill published in the GitHub repository znlgis/my-opencode-deepseek-config (57 stars, last pushed 4d ago), licensed MIT. It adds 92 tokens to every session and 763 once invoked, about $0.0005 per session on Opus 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-08-30.

Related

Other skills, from other repositories

skill-creator

Create, install, or update skills in the workspace. Use when (1) installing a skill from a URL or remote source, (2) creating a new skill from scratch, (3) updating or restructuring existing skills. Always use this skill for any skill installation or creation task.

zhayujie/CowAgent · 61 tokens

external-context

Invoke parallel document-specialist agents for external web searches and documentation lookup.

Yeachan-Heo/oh-my-claudecode · 16 tokens

reflect

Review recent work, find repeated workflow patterns, and suggest reusable skills, agents, commands, config changes, or playbooks. Use when the user asks to learn from past sessions, improve recurring workflows, or identify what should be turned into reusable agent instructions.

alvinunreal/oh-my-opencode-slim · 53 tokens

codemap

Generate comprehensive hierarchical codemaps for UNFAMILIAR repositories. Expensive operation - only use when explicitly asked for codebase documentation or initial repository mapping.

alvinunreal/oh-my-opencode-slim · 34 tokens

scientific-schematics

Create publication-quality scientific diagrams using Nano Banana 2 AI with smart iterative refinement. Uses Gemini 3.1 Pro Preview for quality review. Only regenerates if quality is below threshold for your document type. Specialized in neural network architectures, system diagrams, flowcharts, biological pathways…

xintaofei/codeg · 68 tokens

weibo-poster

微博内容创作 - 140字优化、话题热搜、@提及策略、配图描述、发布时机.

dongsheng123132/u-claw · 32 tokens