routine-dead-code-removal

Detects, verifies, and deletes provably unreachable code from monorepo packages using Knip and Vulture.

275|32|Updated Oct 2, 2020
One-click install
npx skills add https://github.com/bex-co/beancount-io --skill routine-dead-code-removal-bex-co
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: routine-dead-code-removal
Source: https://github.com/bex-co/beancount-io/tree/main/.agents/skills/routine-dead-code-removal
Command: npx skills add https://github.com/bex-co/beancount-io --skill routine-dead-code-removal-bex-co

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Dead code accumulates in large monorepos and detectors like Knip or Vulture produce false positives around dynamic imports, file-based routes, and codegen entry points, making manual cleanup risky and slow. ## Core Features & Use Cases - Detector-driven discovery: Runs the package's own dead-code detector (yarn lint:deadcode via Knip for JS/TS packages, make deadcode via Vulture for the Python CLI) to surface candidates. - Reference verification: Greps for string references, dynamic imports, Expo Router file-based routes, and codegen inputs before deleting anything, converting confirmed false positives into scoped knip.jsonc ignores. - Safe removal and shipping: Applies safe fixers (yarn lint:deadcode:fix, make deadcode-fix), deletes orphaned tests and fixtures, re-runs the package's full verification gate, and ships each removal individually via /ship. - Use Case: Run /routine-dead-code-removal mobile to survey the mobile package, prove each Knip hit is unreachable, delete the dead code with its tests, and ship each removal as a separate verified change. ## Quick Start Invoke /routine-dead-code-removal with an optional package path, for example /routine-dead-code-removal cli, to find and delete provably unreachable code in that package.

Frequently Asked Questions about routine-dead-code-removal

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find and delete dead code in a monorepo package?

Run the package's own detector first: yarn lint:deadcode (Knip) for JS/TS packages or make deadcode (Vulture) for the Python CLI. Treat each hit as a candidate, verify it with a reference sweep, then delete it and ship the removal individually.

How do I avoid Knip false positives when removing unused code?

Grep the whole package for the symbol or file name as a string to catch dynamic imports, registries, and config-referenced entries. Confirmed false positives should become scoped ignores in the package's knip.jsonc with a short reason instead of deletions.

Does dead code detection work with Expo Router file-based routes?

Files under mobile/app/ are routes reachable by navigation and deep links even with zero imports, so they are never dead-code findings. The reference sweep explicitly excludes file-based routes from deletion candidates.

When should I not use dead code removal on a finding?

Skip branches dead only because of a feature flag, live duplicate implementations whose callers need repointing, and tests that pass but assert nothing. Those belong to other routines such as feature-flag inlining or duplicate unification.

What happens to tests and fixtures for deleted code?

Tests and fixtures whose only purpose was exercising the removed code are deleted along with it. Afterward the package's full verification gate runs plus a clean detector re-run to confirm nothing was orphaned.