What problem does it solve? Refactoring legacy code without breaking existing behavior is risky when test coverage is thin. This Skill provides a structured Domain-Driven Development workflow that captures current behavior with characterization tests before making any structural change, so refactoring never silently alters what the code does. ## Core Features & Use Cases - ANALYZE Phase: Identifies domain boundaries, coupling and cohesion metrics (Ca, Ce, instability), and problematic patterns like god classes and feature envy using AST-grep structural analysis. - PRESERVE Phase: Creates characterization tests and behavior snapshots that document what the code actually does, then verifies the test safety net before any change. - IMPROVE Phase: Applies incremental refactorings (extract method, extract class, move method, rename) with continuous test validation after every step and immediate revert on failure. - Use Case: When modernizing a production module with minimal tests, run this workflow to build a characterization test safety net, then restructure the code step by step while every existing test and behavior snapshot stays green. ## Quick Start Ask the AI to refactor a legacy module using the DDD workflow, starting with characterization tests to preserve its current behavior.