Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Batch Dead Code Deletion

ASecurity

Batch-verify and delete dead code: rg-confirm zero callers for N symbols, delete files, run the build once, stage results.

2 stars
0 votes
0 copies
0 views
Added 10/6/2026
ai-agentsrustgobashgit

Works with

mcp

Security Analysis

A100/100

Scanned 10/6/2026

$npx -y skills add e128/dotnet-reference --skill batch-dead-code-deletion --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Batch Dead Code Deletion?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Batch Dead Code Deletion
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/e128-batch-dead-code-deletion/badge)](https://www.skillsdirectory.com/skills/e128-batch-dead-code-deletion)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
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
---

# 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 **do not 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, do not 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` file:
- Read the file
- Edit to remove only the dead type's definition block
- `git add` the modified file

**Delete 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.

## Step 4: Verify Build (skip in DRY_RUN)

```bash
scripts/check.sh --no-format --json
```

One run covers all deletions. If the build fails:
- Parse errors for CS0246 (missing type) or similar
- Report which deletion caused the break
- Print recovery: `git checkout -- src/{file}` for each failed file

## Step 5: Stage Results (skip in DRY_RUN)

```bash
scripts/internal/stage.sh
```

## Step 6: Report

```
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}
```

## Rules

- **Delete only after classification confirmation.** Every symbol must be
  confirmed `DEAD` (zero non-definition references) before deletion.
- **Do not trust `find_dead_code` alone.** ~33% false-positive rate, confirm with `rg`.
- **Extension class gotcha.** Grep the public method names, not the class name.
- **Multi-type files: edit, do not delete.**
- **One build run.** After all deletions, not per symbol.
- **Stage only: do not commit.** The caller handles commits.
- **`--dry-run` is the only mode that writes nothing.** Without the flag, the skill deletes files.

Attribution

e128e128
View sourceSee grades on GitHubMore from e128 →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698461 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →