reversa-refactor

Inventories and prioritizes legacy code refactoring opportunities by ROI for specialist routing.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Legacy systems accumulate code smells and structural debt, but teams lack a systematic way to decide where refactoring effort pays off. This Skill analyzes existing code, catalogs improvement opportunities, and ranks them by real return on investment instead of aesthetics.

Core Features & Use Cases

  • Opportunity Inventory: Scans legacy code and classifies each finding by specialist verb (restructure, modularize, decouple, optimize, simplify, standardize, prune) with traceability to existing specifications.
  • ROI-Based Prioritization: Ranks opportunities by impact, cost, and risk using hotpath heuristics (coupling, execution frequency, git change rate) plus confidence levels based on test coverage.
  • Specialist Routing: Presents a prioritized menu and routes each chosen opportunity to the appropriate transformation specialist without ever applying changes itself.
  • Use Case: Point it at a legacy module like a freight calculation or auth component, and receive a prioritized list of refactoring opportunities with expected returns and the exact specialist command to execute each one.

Quick Start

Ask the agent to analyze the legacy codebase and show which refactoring opportunities in a specific module offer the highest return.

Frequently Asked Questions about reversa-refactor

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

FAQPage Schema
How do I prioritize which legacy code to refactor first?

This Skill ranks opportunities by real return: impact multiplied by cost and risk. It uses a hotpath heuristic favoring code with high coupling, high execution frequency, or high change rate in git history, so frequently-run code outranks large but dormant files.

How to identify code smells in a legacy project automatically?

The Skill reads the target code and classifies each finding by verb: restructure for long methods and god classes, decouple for concrete dependencies and cycles, prune for dead code candidates, and four others. Each opportunity is recorded with its smell, target files, and ROI estimate.

Does this refactoring tool modify my source code?

No. It only inventories, prioritizes, and routes opportunities; it never applies transformations. All writes go to the _reversa_refactor/ registry folder, while project code and specifications remain read-only. Actual changes are applied by separate specialist skills with approval gates.

Can I use this with Claude Code, Cursor, or other AI agents?

Yes. The Skill declares compatibility with Claude Code, Codex, Cursor, Gemini CLI, and other agents supporting the Agent Skills format. It is installed into the project's agent skills directory by the Reversa installer.

What happens when refactoring opportunities lack test coverage?

Each opportunity gets a confidence marker: green for tested and understood code, yellow for partial, red for unproven behavior. Low-confidence items require the specialist to build a characterization test safety net before any transformation can pass the approval gate.