reversa-decouple

Reduces direct dependencies between components using dependency inversion and Feathers seams with measured coupling.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Legacy codebases accumulate tight coupling between components: concrete dependencies where abstractions belong, dependency cycles, and internal knowledge leaking across modules. This makes code hard to change, test, and reuse, and risky for AI agents to modify safely.

Core Features & Use Cases

  • Coupling Measurement: Counts incoming and outgoing dependencies before and after each change, requiring numeric proof of reduction rather than subjective claims.
  • Decoupling Techniques: Applies Feathers seams, interface extraction, dependency injection, and cycle breaking without altering observable behavior.
  • Gated Safety Workflow: Requires characterization tests as a safety net before touching code, shows diffs for approval at each gate, and reverts automatically if tests fail.
  • Use Case: A legacy module directly instantiates a database client, making it untestable. The skill proposes injecting the dependency behind an interface, measures coupling dropping from 8 to 3 outgoing dependencies, and proves behavior is preserved with green tests.

Quick Start

Run /reversa-decouple on a tightly coupled component to propose a seam, review the diff, and verify the measured coupling reduction.

Frequently Asked Questions about reversa-decouple

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

FAQPage Schema
How do I reduce coupling between components in legacy code?

Identify concrete dependencies where abstractions fit, then apply dependency inversion, interface extraction, or Feathers seams. Measure incoming and outgoing dependencies before and after to prove the reduction numerically, and protect the change with characterization tests.

What is a Feathers seam and when should I use one?

A seam is a point where you can alter behavior without editing the code directly, from Michael Feathers' legacy code methodology. Use seams to introduce test coverage around tightly coupled components before extracting interfaces or injecting dependencies.

Does this refactoring change the behavior of my code?

No. Decoupling only changes which components depend on which, never the observable result. The skill enforces this by requiring a green safety net of tests after every change and reverting the diff if any test fails.

Can I run decoupling without existing tests?

Not directly. The skill requires a safety net first and offers to write characterization tests that pin current behavior before introducing any seam or abstraction. If you refuse the safety net, the risk level is raised and the lack of proof is recorded.

What are the prerequisites for running reversa-decouple?

You must run /reversa-refactor first to create the _reversa_refactor directory with control mode and safety net policy. The skill also reads .reversa/state.json for output folder and language settings, and aborts if these are missing.