What problem does it solve? Refactoring legacy code without breaking existing behavior is risky, especially when test coverage is thin and the codebase has high coupling. This Skill provides a structured Domain-Driven Development workflow that guarantees observable behavior stays identical while code structure improves. ## Core Features & Use Cases - ANALYZE Phase: Identify domain boundaries, compute coupling/cohesion metrics (Ca, Ce, Instability), and detect structural problems like god classes and feature envy using AST-grep pattern analysis. - PRESERVE Phase: Build characterization tests and behavior snapshots that capture what the code actually does, creating a verified safety net before any change. - IMPROVE Phase: Apply incremental refactorings (extract method, extract class, move method, rename) with continuous test validation after every small change. - Use Case: You inherit a production Python service with tangled modules and partial tests. Run the DDD cycle to map dependencies, add characterization tests for critical paths, then safely restructure the code one verified commit at a time. ## Quick Start Ask the AI to run the DDD workflow on a legacy module to analyze its structure, add characterization tests, and refactor it while preserving behavior.