What problem does it solve? Restructuring legacy or messy code without breaking behavior is risky and hard to prioritize. This Skill provides a disciplined workflow for safe, incremental refactoring: it diagnoses test safety nets, ranks targets by hotspot analysis (complexity x churn), applies atomic transformations, and verifies behavior preservation at every step. ## Core Features & Use Cases - Safety-net diagnosis and construction: Classifies code as greenfield or brownfield, and writes characterization (golden-master) tests before touching untested production code. - Hotspot-driven target selection: Combines static complexity metrics (radon, lizard) with git forensics (churn, bug history, SATD markers) to rank what to refactor first. - Atomic verified transformations: Applies one named refactoring per commit, re-runs frozen tests after each step, and uses the Mikado method to revert and recurse when prerequisites break. - Use Case: You inherit a legacy Python module with 800-line files and no tests. The Skill finds a seam, writes golden-master tests pinning current behavior, then executes a sequence of extract-method refactorings, each committed separately with before/after complexity metrics. ## Quick Start Ask the agent to refactor the long methods in a target module while preserving behavior, building characterization tests first if coverage is missing.