reversa-prune

Removes dead code only after proving no static references or dynamic entry points exist.

1.5k|405|Updated Apr 26, 2026
One-click install
npx skills add https://github.com/sandeco/reversa --skill reversa-prune
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: reversa-prune
Source: https://github.com/sandeco/reversa/tree/main/agents/reversa-prune
Command: npx skills add https://github.com/sandeco/reversa --skill reversa-prune

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Legacy codebases accumulate unused code that nobody dares to delete because it might be reached through dynamic entry points like reflection, routes, events, or feature flags. This Skill removes dead code safely by requiring formal proof of death before any deletion, and by distinguishing truly dead code from suspicious orphans that should be kept.

Core Features & Use Cases

  • Death-proof verification: A candidate is only classified as dead when it has zero static references across a full usage scan AND no known dynamic entry point (routes, events, reflection, meta-programming, string loading, config, cron, feature flags).
  • Soul cross-check: Before marking anything as dead, it checks the code against the project's confirmed business rules in soul.md; code implementing a confirmed rule is never removed, even if it appears unused.
  • Mandatory approval gate: Every removal requires an approved diff with per-snippet proof attached, works in any control mode including autonomous, and stays reversible through CHG-NNN.diff files.
  • Use Case: While refactoring a legacy module, you run the prune agent on an opportunity; it produces a self-contained HTML plan listing candidates classified as dead versus suspicious orphans, waits for your approval, removes only the proven-dead code, and runs the test suite to confirm green.

Quick Start

Ask the agent to run /reversa-prune on a specific opportunity or target after the reversa-refactor context has been initialized.

Frequently Asked Questions about reversa-prune

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

FAQPage Schema
How do I safely remove dead code from a legacy codebase?

Run the prune agent on a target or opportunity; it scans all usages, checks dynamic entry points like routes and reflection, and only removes code proven dead. Every removal requires your approval of a diff with per-snippet proof attached.

What counts as dead code in this pruning workflow?

Code is dead only when it has zero static references in a complete usage scan and no known dynamic entry point such as events, reflection, meta-programming, string loading, config, cron, or feature flags. Anything uncertain is classified as a suspicious orphan and never removed.

Can dead code removal be reversed after deletion?

Yes, every removal is recorded as a CHG-NNN.diff file in the transformation folder, making the change fully reversible. The agent also runs the test suite when available and reports the green output as confirmation.

Does the prune agent work without the reversa-refactor setup?

No, it aborts with an instruction to run /reversa-refactor first if the _reversa_refactor directory does not exist. It depends on that context for control mode, opportunities, and the opportunity schema.

Why is some unused-looking code never removed?

Code implementing a confirmed business rule from soul.md is never treated as dead, even without visible usage, because it may be a temporarily disconnected path. Such code is reported as a suspicious orphan with the rule it serves.