← ClaudeAtlas

deleting-dead-codelisted

Use when the user asks to remove, delete, strip, or clean up code or docs, OR when you yourself observe dead, unreachable, slop, misleading, or unused code/documentation paths during any task. Senior engineers delete; junior engineers refactor around. This skill makes the model behave like the former. Git is the safety net — if a file is tracked, deletion is trivially reversible, so deletion is the correct first move, not the last resort.
simbo1905/deleting-dead-code · ★ 0 · Code & Development · score 73
Install: claude install-skill simbo1905/deleting-dead-code
# Deleting Dead Code ## Why this skill exists Models default to additive moves. Shown bad code, the trained reflex is to refactor, wrap, comment, flag, or "preserve behaviour" — anything except remove. This produces context pollution: dead code, lying code, and misleading code accumulate across sessions because no model ever pulls the trigger. The user then spends 36-hour sessions undoing what the model wouldn't. This skill flips the default. When the conditions below are met, deletion is the senior-engineer move and the model should execute it directly. ## The core rule **If the file is tracked in git, deletion is trivially reversible. Therefore delete first, restore on request.** A `git rm -f` (or an equivalent in-place deletion followed by `git add`) is recoverable with `git restore` or `git checkout HEAD~1 -- <path>`. There is no asymmetric risk. The asymmetric risk is in the *opposite* direction: leaving slop or dead code in place lets it propagate, mislead future readers, and corrupt context windows. ## When to delete (rationalisation criteria) Delete when **all** of these hold: 1. **The file is tracked in git.** Run `git ls-files --error-unmatch <path>` or `git log -1 -- <path>`. If it is not tracked, stop and ask — there is no safety net. 2. **The intent is rationalisation, not feature change.** The user wants fewer bad paths, not new behaviour. Phrases like "this is slop," "this is dead," "remove the lying endpoint," "strip the unused branch," "deletes only"