What problem does it solve? Refactoring legacy or tangled code with AI is risky: the AI cannot tell whether strange-looking code is a bug or intentional business logic, and large rewrites cause behavior drift. This Skill enforces a disciplined workflow—understand first, lock behavior with tests, then refactor in small verified steps—so refactoring never silently changes observable behavior. ## Core Features & Use Cases - Four-Phase Linear Process: Documentation and architecture mapping, Characterization Test creation to lock existing behavior, diagnostic refactoring report (God Objects, Long Methods, circular dependencies), and a dependency-ordered roadmap with rollback strategies. - Hard Brake Points & Human Gates: Forces human confirmation when AI cannot distinguish bug from feature, before architecture evolution, before merging dependency-breaking changes with drift risk, and when tests lock in suspected buggy behavior. - Mandatory CI Verification: Every commit must pass remote CI (never local swift test or xcodebuild test), with three parallel review sub-agents checking behavior preservation, hallucinated APIs, fake-green tests, and privacy leaks. - Use Case: You inherit a macOS Xcode project with a 3000-line VisionManager God Object. The Skill walks you through documenting the architecture, writing characterization tests verified in CI, generating a prioritized diagnosis report, then extracting services one small merge-only commit at a time with full CI validation. ## Quick Start Ask the AI to refactor a legacy module using the AI refactoring workflow, starting with behavior-locking characterization tests before any code changes.