resonance-ops-refactor

Refactors code to reduce complexity while preserving behavior using the Mikado Method and Safe Sequence.

Updated Dec 1, 2025
One-click install
npx skills add https://github.com/manusco/wolfgang --skill resonance-ops-refactor-manusco
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: resonance-ops-refactor
Source: https://github.com/manusco/wolfgang/tree/main/.agents/skills/ops/refactor
Command: npx skills add https://github.com/manusco/wolfgang --skill resonance-ops-refactor-manusco

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Codebases accumulate God classes, duplicated business rules, and scattered permission checks that silently drift and break when requirements change. This Skill performs surgical refactoring that reduces complexity without changing observable behavior, verified by a green test suite before and after every change. ## Core Features & Use Cases - Safe Sequence Refactoring: Applies a risk-ordered workflow (Lock, Extract, Centralize, Split, Cleanup) so structural changes never mix with behavioral changes in the same commit. - Mikado Method Planning: Maps the dependency graph and fixes leaf dependencies first, reverting instead of pushing through when a change breaks. - Business-Risk Diagnosis: Uses a code smell matrix to name the concrete business consequence of each smell, such as authorization drift from duplicated access checks, rather than citing aesthetics. - Use Case: When discount logic is duplicated across CartService, InvoiceService, and ReportService with slight variations, the Skill locks current behavior with tests, extracts a single DiscountCalculator, and swaps call sites one at a time with verification after each. ## Quick Start Ask the assistant to refactor the duplicated discount logic in the cart, invoice, and report services into a single shared service without changing any behavior.

Frequently Asked Questions about resonance-ops-refactor

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

FAQPage Schema
How do I refactor a God class without breaking behavior?▼

Start with a green test suite, write a Do Not Change declaration listing preserved behaviors, then use the Mikado Method to fix leaf dependencies first. Apply the Safe Sequence: lock behavior with tests, extract responsibilities, then split the class, one concern per commit.

How to deduplicate business logic spread across multiple services?▼

First verify whether the implementations are truly identical or intentionally different. Write tests capturing current behavior of each copy, extract a single shared service as the source of truth, then replace call sites one at a time, running tests after each swap.

Can I combine refactoring with adding features in the same commit?▼

No. Structural changes and behavioral changes must ship as separate commits. Mixing them makes the blast radius unverifiable, so feature work like logging or type migrations becomes its own task with its own commit.

What is the Mikado Method for large refactoring?▼

The Mikado Method attempts the goal change, records each failure as a prerequisite dependency, reverts to a clean state, then fixes leaf dependencies first. If code stays broken for more than 15 minutes, revert rather than push through.

When should I not refactor code?▼

Do not refactor untested code; write characterization tests first. Also deprioritize changes where you cannot name a concrete business consequence, since aesthetic-only refactors carry risk without addressing real drift or breakage.