reversa-simplify

Replaces complex logic with simpler equivalent implementations verified by output-equivalence proofs.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Legacy codebases accumulate convoluted logic that is hard to read and risky to change. This Skill reduces cognitive complexity by replacing tangled implementations with simpler ones while proving the behavior stays identical, so refactoring never silently breaks business rules.

Core Features & Use Cases

  • Equivalence-Proof Simplification: Proposes a simpler algorithm and proves it produces the same outputs for the same inputs, including edge cases like empty, null, boundary, and concurrency scenarios.
  • Safety-Net Enforcement: Requires characterization tests covering the target before any code change; without coverage it creates green characterization tests first.
  • Gated Changes with Diffs: Every code modification passes through an approval gate showing before/after diffs, with automatic revert if the safety net turns red.
  • Use Case: A legacy pricing function has five nested conditionals. The Skill shows the complexity is accidental, proposes a lookup-table version, proves equivalence across all input cases, and applies the change only after your approval.

Quick Start

Run /reversa-simplify with an opportunity ID or a target function after setting up the reversa-refactor context, then approve the proposed diff at the gate.

Frequently Asked Questions about reversa-simplify

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

FAQPage Schema
How do I simplify complex legacy code without changing its behavior?

Run /reversa-simplify on a target function or opportunity. It requires characterization tests that pin current outputs, then proposes a simpler implementation and proves output equivalence across edge cases before applying any gated diff.

What is the difference between reversa-simplify and reversa-optimize?

reversa-simplify targets cognitive complexity and readability of logic, while reversa-optimize targets measured resource performance. If your real goal is a measured speedup, the skill redirects you to /reversa-optimize.

Can I run reversa-simplify without setting up reversa-refactor first?

No. The skill reads control_mode and safety_net_policy from the _reversa_refactor directory and aborts with a message to run /reversa-refactor first if that context does not exist.

What happens if the simplified code fails the test suite?

If the safety net turns red after applying the change, the skill reverts the modification using the recorded diff. No code change is kept without green tests proving equivalent behavior.

Does simplification ever remove business logic hidden in complex code?

No. The skill distinguishes accidental complexity from essential complexity required by confirmed business rules. Essential complexity is documented rather than removed, checked against the project's soul.md and confirmed specs.