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.
npx skills add https://github.com/ArabelaTso/Skills-4-SE --skill 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:
False-positive guards — NEVER mark as dead:
index re-exports@public / @api doc tagscreateXXXHook), tool factories (createXXXTool), plugin definitionsRun ALL of these in parallel:
Compiler/linter strict mode (primary scanner — run FIRST):
# 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.
For EACH candidate from Phase 1:
# 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 entirelyPREFIX _ — unused function parameter required by signature → rename to _paramNameIf ZERO confirmed: report "No dead code found" and STOP.
Goal: maximize parallel execution with ZERO conflicts.
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.
For EACH batch:
_ (do NOT remove — required by signature)rmgit checkout -- [files] and report failuregit add [your-specific-files] && git commit -m "refactor: remove dead code from [brief file list]"
git add [specific files]). NEVER git add -A — other batches may be running in parallel.After ALL batches complete:
# 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:
## 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
If a specific scope is provided, narrow the scan:
all or empty → full project scan (default)STOP and report if:
Inspired by: oh-my-opencode remove-deadcode command
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification
Take arabelatso/dead-code-removal from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference npx.
Without those the skill loads but fails at the first command.