What problem does it solve?
Refactoring without a safety net risks silently changing behavior, and teams often don't know which code to refactor first or whether their tests would even catch a regression. This Skill enforces disciplined, verifiable restructuring: it diagnoses test coverage before touching code, ranks targets by complexity and churn, and commits each transformation separately so behavior changes never hide inside refactors.
Core Features & Use Cases
- Safety-net diagnosis and characterization tests: Classifies targets as greenfield or brownfield, checks coverage/flakiness/mutation strength, and writes golden-master tests before restructuring legacy code.
- Hotspot-driven target selection: Combines static complexity metrics (radon, lizard) with git forensics (churn, bug-fix history, SATD markers) to rank what to refactor first.
- Atomic transformation workflow: Applies one named transformation per commit using engine-first tools (Serena rename_symbol, codemods, ast-grep), re-running unchanged tests after each step, with Mikado-method revert-and-recurse recovery on failure.
- Use Case: You inherit a legacy module with no tests and several 800-line files. The Skill finds a seam, writes characterization tests pinning current behavior, then executes an extract-and-rename sequence as separate refactor-only commits, ending with a before/after complexity and readability report.
Quick Start
Ask the agent to refactor the legacy module at src/payments into smaller behavior-preserving commits, building characterization tests first if coverage is missing.