← ClaudeAtlas

batch-dead-code-deletionlisted

Batch-verify and delete dead code: rg-confirm zero callers for N symbols, delete files, run the build once, stage results.
e128/dotnet-reference · ★ 2 · Data & Documents · score 74
Install: claude install-skill e128/dotnet-reference
# Batch Dead-Code Deletion Verify and delete N dead symbols in one pass. Accepts class names, interface names, or method names. ## Step 1: Parse Arguments - If `--dry-run` is present: set DRY_RUN mode (report only, no deletions) - Remaining tokens are the symbol list - If no symbols provided: print usage and stop ## Step 2: Classify Each Symbol For each symbol, confirm it is dead before touching it. Classify into one of: `DEAD` (no non-definition references), `ALIVE` (referenced in `src/`), `TEST-ONLY` (referenced only under `tests/`), or `ANCHOR` (only reference is a `typeof(X).Assembly` marker in an architecture-test fixture). 1. **Find the defining file(s)** — `scripts/find.sh --class {Symbol}` (or `rg -l "class {Symbol}|interface {Symbol}|record {Symbol}" src/`). 2. **Count references** — `rg -w "{Symbol}" src/ tests/ -g '*.cs'`. Exclude the definition site. For **extension methods**, the class name never appears at call sites — grep the public *method* names instead. 3. **Cross-check (optional)** — the `find_dead_code` Roslyn MCP tool can suggest candidates, but **don't trust it alone** (~33% false-positive rate). The `rg` caller count is authoritative. 4. **Flag multi-type files** — if the defining file declares more than one type, mark it `multi_type` (edit, don't delete). ## Step 3: Execute Deletions (skip in DRY_RUN) For each DEAD symbol in a single-type file: ```bash git rm src/{defining_file} ``` For each DEAD symbol in a `multi_type` fi