Skip to content
Skills Library
Programming · Automation

routine-dead-code-removal

/routine-dead-code-removal

Autonomous maintenance routine that deletes provably unreachable code from one monorepo package using the repo's own detectors (yarn lint:deadcode / make deadcode / scripts/lint-deadcode.sh), verifies every hit against dynamic references before deleting, and ships each removal via /ship. Use only when the user explicitly invokes /routine-dead-code-removal or asks to find and delete dead or unused code. SKIP for dead branches behind a feature flag (routine-shipped-feature-inliner), live duplicates whose callers need repointing (routine-dup-unifier), tests that pass but assert nothing (routine-u

Licence
MIT
Last repository change
27.10.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Autonomous maintenance routine that deletes provably unreachable code from one monorepo package using the repo's own detectors (yarn lint:deadcode / make deadcode / scripts/lint-deadcode.sh), verifies every hit against dynamic references before deleting, and ships each removal via /ship. Use only when the user explicitly invokes /routine-dead-code-removal or asks to find and delete dead or unused code. SKIP for dead branches behind a feature flag (routine-shipped-feature-inliner), live duplicates whose callers need repointing (routine-dup-unifier), tests that pass but assert nothing (routine-u

Original author description

Autonomous maintenance routine that deletes provably unreachable code from one monorepo package using the repo's own detectors (yarn lint:deadcode / make deadcode / scripts/lint-deadcode.sh), verifies every hit against dynamic references before deleting, and ships each removal via /ship. Use only when the user explicitly invokes /routine-dead-code-removal or asks to find and delete dead or unused code. SKIP for dead branches behind a feature flag (routine-shipped-feature-inliner), live duplicates whose callers need repointing (routine-dup-unifier), tests that pass but assert nothing (routine-u

How it works

  1. Contract
  2. Workflow
  3. What NOT to do
  4. Arguments
Original SKILL.md headings · 89 lines, 489 words
SKILL.md preview
---
name: routine-dead-code-removal
description: Autonomous maintenance routine that deletes provably unreachable code
  from one monorepo package using the repo's own detectors (yarn lint:deadcode /
  make deadcode / scripts/lint-deadcode.sh), verifies every hit against dynamic
  references before deleting, and ships each removal via /ship. Use only when the
  user explicitly invokes /routine-dead-code-removal or asks to find and delete
  dead or unused code. SKIP for dead branches behind a feature flag
  (routine-shipped-feature-inliner), live duplicates whose callers need repointing
  (routine-dup-unifier), tests that pass but assert nothing
  (routine-useless-test-pruner), or live single-implementation indirection
  (routine-abstraction-improver). The core trigger is "find and delete code
  nothing can reach".
metadata: {"internal": true}
---

# Task: Delete provably unreachable code

Usage: `/routine-dead-code-removal [package-or-path]`

Run the target package's dead-code detector, prove each hit is truly
unreachable, delete it (with the tests and fixtures that only existed for it),
make the package's checks pass, and ship each removal via `/ship`.

## Contract

Read `.agents/skills/routine-shared/contract.md` first — it defines
preconditions, scope resolution, verify gates, the ship protocol, the budget,
and universal STOPs. This file adds only what is specific to dead code. Floor
even without it: never ship red; one finding per ship; anything in a
`DO_NOT_DO.md` is a hard STOP.

## Workflow

### 1. Scope

Resolve scope per the contract. With no argument, prefer running
`scripts/lint-deadcode.sh` from the repo root once as a survey, then pick the
one package with the most promising hits.

### 2. Discover

`cd` into the package, then run its detector:

- JS/TS packages (`mobile`, `dashboard`, `backend-cluster/backend-v2`,
  `backend-cluster/ledger`, `backend-cluster/agent-box`) → `yarn lint:deadcode`
  (Knip; config in the package's `knip.jsonc`)
- `cli/` → `make deadcode` (Vulture; high-confidence only)

Also legitimate finds while reading nearby code: commented-out blocks,
`if (false)`-style branches, early-return shadowed code. A detector hit is a
**candidate, not proof**.

### 3. Prove it

For every candidate, sweep for references the detector can't see before
touching anything:

- Grep the whole package for the symbol/file name as a **string** — dynamic
  imports, registries, config-referenced entries, test fixtures.
- Expo Router is file-based: files under `mobile/app/` are routes reachable by
  navigation and deep links even with zero imports — never a dead-code finding.
- Codegen inputs (GraphQL documents, `codegen.ts`, `apollo.config.json`) and
  build/tooling entry points (`babel.config.js`, scripts referenced from
  `package.json`) count as reachable.

A confirmed **false positive** is its own legitimate finding: add a scoped
ignore to the package's `knip.jsonc` (with a short reason) instead of deleting,
so the detector stays trustworthy.

### 4. Fix

- Prefer the safe fixers where they apply: `yarn lint:deadcode:fix` /
  `make deadcode-fix` — then **review the resulting diff before keeping it**
  (root `AGENTS.md` rule). Discard anything the proof step didn't cover.
- Delete manually what the fixers can't reach (commented-out blocks,
  unreachable branches).
- Delete tests and fixtures whose only purpose was exercising the removed code
  — they travel with it.

### 5. Verify

Run the owning package's full gate from the contract's table, plus a clean
re-run of the detector to confirm nothing was orphaned by the deletion.

### 6. Ship

Compose `/ship` for this one removal. Loop back to step 2 while candidates and
budget remain.

## What NOT to do

- Never delete a branch that is dead only because a feature flag holds one
  value — that is `routine-shipped-feature-inliner`'s job.
- Never delete one of two live duplicate implementations — that is
  `routine-dup-unifier`'s job (it repoints callers first).
- Never touch the CLI's vendored `fava` code, codegen output, or lockfiles.
- Never trust a Knip/Vulture hit without the reference sweep — file-based
  routes and dynamic lookups are exactly where detectors lie.

## Arguments

$ARGUMENTS

Versions

The database has no other skills named routine-dead-code-removal.

Database snapshot: 13.11.2026 · package version 7cb627dd3ca1 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 90routine-dup-unifier
    Autonomous maintenance routine that finds duplicated implementations of the same logic within one monorepo package, merges them into the single best copy, repoints every caller, deletes the rest, and ships each unification via /ship. Use only when the user explicitly invokes…
  • 100routine-shipped-feature-inliner
    Autonomous maintenance routine that finds gates for fully shipped features — flags, env switches, boolean guards that have held one value everywhere for a long time — triages deliberate gates from forgotten ones, inlines the enabled path, deletes the dead branch and the flag…
  • 95vulture-dead-code
    Vulture and deadcode tools for detecting unused Python code (functions, classes, imports). Use when cleaning up codebases or removing dead code. Triggers vulture, deadcode.
  • 90dead-code-removal
    Find code that can never run and delete it without breaking a caller you missed. Use when pruning unused functions, branches, feature flags, or files.
  • 100configure-dead-code
    Dead-code detection: Knip, Vulture, cargo-machete, deadcode. Use when setting up unused-code scanning, migrating tools, or adding dead-code CI checks.
  • 100dead-code-removal
    Use when unused functions, classes, exports, or files need to be identified and safely deleted.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.