一键导入
batch-dead-code-deletion
Batch-verify and delete dead code: rg-confirm zero callers for N symbols, delete files, run the build once, stage results.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Batch-verify and delete dead code: rg-confirm zero callers for N symbols, delete files, run the build once, stage results.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Run benchmarks and check regressions, add benchmark gating to CI, or audit GitHub Actions workflows. Determines mode from user intent.
Batch-apply findings from the most recent --local review. One confirmation, one test run.
Orchestrated code review of git diff using parallel agents. Standard mode (diff-scoped) or full mode (adds Roslyn semantic analysis). Produces severity-grouped plan.
Unified code review: --local (diff review), --pr (adversarial PR review), --apply (batch fixes from last review).
Audit .NET solution health across 13 dimensions: dependency graph, solution sync, CPM compliance, package health, framework consistency, IVT & encapsulation, build config, analyzer config, NuGet config, suppression hygiene, output type & AOT, public API surface, and lock files & pruning. Works with any .NET solution (.slnx or .sln). Parses all config files once, spawns 3 parallel agents, and produces a severity-grouped report with a Mermaid dependency graph. Triggers on: solution audit, audit solution, project graph, dependency audit, solution health, audit projects, check solution.
Scans source and .claude/ files for anti-pattern violations, applies the top mechanical fixes, and reports pre/post counts.
| name | batch-dead-code-deletion |
| description | Batch-verify and delete dead code: rg-confirm zero callers for N symbols, delete files, run the build once, stage results. |
| when_to_use | batch dead code, delete dead code, dead code deletion, bulk delete dead, batch delete types, remove dead types, prune dead code, dead code cleanup. |
| argument-hint | Space-separated symbol names, optionally prefixed with --dry-run. Example: /batch-dead-code-deletion FooService BarHelper IWidgetFactory Example: /batch-dead-code-deletion --dry-run FooService BarHelper |
| allowed-tools | Bash, Read, Glob, Grep, Write, Edit |
Verify and delete N dead symbols in one pass. Accepts class names, interface names, or method names.
--dry-run is present: set DRY_RUN mode (report only, no deletions)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).
scripts/find.sh --class {Symbol} (or
rg -l "class {Symbol}|interface {Symbol}|record {Symbol}" src/).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.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.multi_type (edit, don't delete).For each DEAD symbol in a single-type file:
git rm src/{defining_file}
For each DEAD symbol in a multi_type file:
git add the modified fileDelete only DEAD symbols — leave ANCHOR, TEST-ONLY, and ALIVE symbols in place.
For ANCHOR symbols: the typeof(X).Assembly reference in the architecture-test
fixture must be repointed to another public type from the same assembly before
deletion.
scripts/check.sh --no-format --json
One run covers all deletions. If the build fails:
git checkout -- src/{file} for each failed filescripts/internal/stage.sh --include-new
Dead-Code Deletion Report
Symbols checked: N
Deleted: N (files: ...)
Multi-type edits: N (removed type X from file Y, ...)
Skipped (alive): N (SymbolA: N refs in src/)
Skipped (anchor): N (SymbolC: typeof ref in file)
Skipped (test): N (SymbolD: N refs in tests/ only)
Build status: PASS / FAIL
Recovery: git checkout -- src/{file}
DEAD (zero non-definition references) before deletion.find_dead_code alone. ~33% false-positive rate — confirm with rg.