reversa-refactor

Inventories legacy code refactoring opportunities, prioritizes by ROI, and routes to specialist agents.

Updated Jun 12, 2026
One-click install
npx skills add https://github.com/lacsousa/mediclaw-system --skill reversa-refactor-lacsousa
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: reversa-refactor
Source: https://github.com/lacsousa/mediclaw-system/tree/main/.agents/skills/reversa-refactor
Command: npx skills add https://github.com/lacsousa/mediclaw-system --skill reversa-refactor-lacsousa

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Legacy codebases accumulate technical debt, but teams struggle to decide where refactoring effort pays off. This Skill acts as an orchestrator that scans working legacy code, inventories improvement opportunities, ranks them by real return on investment (hotpath impact, coupling, change frequency) rather than aesthetics, and routes each one to the right specialist agent. It never modifies code itself. ## Core Features & Use Cases - Opportunity Inventory: Detects code smells and classifies each by specialist verb: restructure, modularize, decouple, optimize, simplify, standardize, or prune. - ROI-Based Prioritization: Ranks opportunities by impact, cost, and risk, with confidence levels (green/yellow/red) tied to test coverage and behavior proof. - Context-Organized Registry: Stores opportunities and transformations per feature or module under _reversa_refactor/<context>/ using a YAML-frontmatter schema, with full traceability to specs and business rules. - Use Case: A developer says "the freight calculation module is a monster." The Skill resolves the context, reads the code, registers prioritized opportunities like "restructure nested conditionals in freight calculator (hotpath, low cost)", and routes the chosen one to /reversa-restructure with a gate before any change is applied. ## Quick Start Ask the agent to analyze the legacy code in a specific module and list which refactorings are worth doing first, ordered by return on investment.

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?▼

Prioritize by real return: impact times cost times risk, favoring hotpath code with high coupling, high execution frequency, or high change rate in git history. The Skill ranks opportunities this way and tags each with a confidence level based on test coverage.

How to identify code smells in a legacy codebase?▼

Scan the target code and classify each finding by type: long methods and god classes map to restructure, mixed responsibilities to modularize, concrete dependencies and cycles to decouple, and unreferenced code to prune. Each finding is recorded with its target files, smell, and ROI estimate.

Does this refactoring orchestrator modify my source code?▼

No. It only inventories, prioritizes, and routes opportunities to specialist agents. It writes exclusively to the `_reversa_refactor/` registry folder and treats all project code, specs, and soul files as read-only.

What happens when refactoring has no test coverage?▼

Opportunities without behavior proof are marked red (low confidence), which conditions the safety net the specialist must require. The default policy requires characterization tests passing green before and after any structural transformation.

When should I not use an ROI-based refactoring workflow?▼

Avoid it for greenfield code with no legacy behavior to preserve, or when you need immediate automated fixes rather than gated, audited transformations. The workflow is designed for maintenance of working systems where behavior preservation must be proven.