Dead Code Removal logo

Dead Code Removal

Community
ArabelaTso
dead-code-removal

Dead code removal via parallel scanning, reference verification, batch execution, and atomic commits. You are the ORCHESTRATOR — you scan, verify, batch, then delegate ALL removals.

Overview

PublisherArabelaTso
RepositorySkills-4-SE
Skill namedead-code-removal
Stars
258
Forks
25
Bundled files
Instructions only
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by ArabelaTso on GitHub. Read the source before you install it.

Installation

Install the Dead Code Removal AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/ArabelaTso/Skills-4-SE/tree/main/skills/dead-code-removal
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ArabelaTso/Skills-4-SE.git /tmp/Skills-4-SE
mkdir -p .claude/skills
cp -r /tmp/Skills-4-SE/skills/dead-code-removal .claude/skills/dead-code-removal
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Dead Code Removal in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Dead Code Removal on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Dead Code Removal is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Dead Code Removal

Dead code removal via massively parallel scanning and execution. You are the ORCHESTRATOR — you scan, verify, batch, then execute all removals with atomic commits.

Rules:

  • Reference verification is law. Verify with grep/language tools before ANY removal decision.
  • Never remove entry points. Main entry files, test files, config files — off-limits.

False-positive guards — NEVER mark as dead:

  • Symbols in entry point files or barrel index re-exports
  • Symbols referenced in test files (tests are valid consumers)
  • Symbols with @public / @api doc tags
  • Hook factories (createXXXHook), tool factories (createXXXTool), plugin definitions
  • Command templates, skill definitions, config objects
  • Symbols in package exports

PHASE 1: SCAN — Find Dead Code Candidates

Run ALL of these in parallel:

Compiler/linter strict mode (primary scanner — run FIRST):

bash
# TypeScript
npx tsc --noEmit --noUnusedLocals --noUnusedParameters 2>&1

# Python
vulture src/ --min-confidence 80

# Go
staticcheck -checks U1000 ./...

This gives you the definitive list of unused locals, imports, parameters, and types with exact file:line locations.

Orphaned file detection (run simultaneously): Find files in src/ NOT imported by any other file. Check all import statements. EXCLUDE: index files, test files, entry points, markdown, config files. Return: file paths.

Unused export detection (run simultaneously): Find exported functions/types/constants that are never imported by other files. Cross-reference: for each export, grep the symbol name across src/ — if it only appears in its own file, it's a candidate. EXCLUDE: entry point exports, test files. Return: file path, line, symbol name, export type.

Collect all results into a master candidate list.


PHASE 2: VERIFY — Reference Confirmation (Zero False Positives)

For EACH candidate from Phase 1:

bash
# Search for all references (excluding the declaration itself)
grep -rn "symbolName" src/ --include="*.ts" | grep -v "declaration_file.ts"

# Or use language-specific tools:
#   TypeScript: ts-prune, ts-unused-exports
#   Python: vulture --min-confidence 80
#   Go: staticcheck -checks U1000

# 0 references = CONFIRMED dead
# 1+ references = NOT dead, drop from list

Also apply the false-positive guards above. Produce a confirmed list:

| # | File | Symbol | Type | Action |
|---|------|--------|------|--------|
| 1 | src/foo.ts:42 | unusedFunc | function | REMOVE |
| 2 | src/bar.ts:10 | OldType | type | REMOVE |
| 3 | src/baz.ts:7 | ctx | parameter | PREFIX _ |

Action types:

  • REMOVE — delete the symbol/import/file entirely
  • PREFIX _ — unused function parameter required by signature → rename to _paramName

If ZERO confirmed: report "No dead code found" and STOP.


PHASE 3: BATCH — Group by File for Conflict-Free Parallelism

Goal: maximize parallel execution with ZERO conflicts.

  1. Group confirmed dead code items by FILE PATH
  2. All items in the SAME file go to the SAME batch (prevents two agents editing the same file)
  3. If a dead FILE (entire file deletion) exists, it's its own batch
  4. Target 5-15 batches. If fewer than 5 items total, use 1 batch per item.

Example batching:

Batch A: [src/hooks/foo/hook.ts — 3 unused imports]
Batch B: [src/features/bar/manager.ts — 2 unused constants, 1 dead function]
Batch C: [src/tools/baz/tool.ts — 1 unused param, src/tools/baz/types.ts — 1 unused type]
Batch D: [src/dead-file.ts — entire file deletion]

Files in the same directory CAN be batched together (they won't conflict as long as no two agents edit the same file). Maximize batch count for parallelism.


PHASE 4: EXECUTE — Apply Removals

For EACH batch:

Protocol

  1. Read each file to understand exact syntax at the target lines
  2. Re-verify with grep that the symbol is still dead (another batch may have changed things)
  3. Apply the change:
    • Unused import (only symbol in line): remove entire import line
    • Unused import (one of many): remove only that symbol from the import list
    • Unused constant/function/type: remove the declaration. Clean up trailing blank lines.
    • Unused parameter: prefix with _ (do NOT remove — required by signature)
    • Dead file: delete with rm
  4. After ALL edits in this batch, run the type checker / build
  5. If build fails: git checkout -- [files] and report failure
  6. If build passes: stage ONLY your files and commit: git add [your-specific-files] && git commit -m "refactor: remove dead code from [brief file list]"
  7. Report what you removed and the commit hash

Critical Rules

  • Stage ONLY your batch's files (git add [specific files]). NEVER git add -A — other batches may be running in parallel.
  • If build fails after your edits, REVERT all changes and report. Do not attempt to fix.
  • Pre-existing test failures in other files are expected. Only the type checker / build matters for your batch.

PHASE 5: FINAL VERIFICATION

After ALL batches complete:

bash
# Language-specific type check (must pass)
npx tsc --noEmit          # TypeScript
mypy src/                  # Python
go vet ./...               # Go

# Tests (note any NEW failures vs pre-existing)
npm test
pytest

# Build (must pass)
npm run build

Produce summary:

markdown
## Dead Code Removal Complete

### Removed
| # | Symbol | File | Type | Commit |
|---|--------|------|------|--------|
| 1 | unusedFunc | src/foo.ts | function | abc1234 |

### Skipped (verification failed)
| # | Symbol | File | Reason |
|---|--------|------|--------|

### Verification
- Type check: PASS/FAIL
- Tests: X passing, Y failing (Z pre-existing)
- Build: PASS/FAIL
- Total removed: N symbols across M files
- Total commits: K atomic commits

SCOPE CONTROL

If a specific scope is provided, narrow the scan:

  • File path → only that file
  • Directory → only that directory
  • Symbol name → only that symbol
  • all or empty → full project scan (default)

ABORT CONDITIONS

STOP and report if:

  • More than 50 candidates found (ask user to narrow scope or confirm proceeding)
  • Build breaks and cannot be fixed by reverting

Inspired by: oh-my-opencode remove-deadcode command

Frequently asked questions

What does the Dead Code Removal AI skill do?

Dead code removal via parallel scanning, reference verification, batch execution, and atomic commits. You are the ORCHESTRATOR — you scan, verify, batch, then delegate ALL removals.

Why use Dead Code Removal on TypingMind?

Because you install it once and use it with any model. Dead Code Removal is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Dead Code Removal in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/ArabelaTso/Skills-4-SE/tree/main/skills/dead-code-removal. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Dead Code Removal?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Dead Code Removal?

As many as you like. As long as a model supports skills, you can use Dead Code Removal with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Dead Code Removal AI skill free?

Yes. It is published on GitHub by ArabelaTso under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇