What problem does it solve? Codebases accumulate technical debt: long functions, duplicated logic, magic numbers, and god classes that make features hard to add and bugs easy to introduce. This Skill provides a systematic, test-safe approach to cleaning up code incrementally without breaking existing behavior. ## Core Features & Use Cases - Code Smell Remediation: Identifies and fixes ten common smells including long methods, duplicated code, feature envy, primitive obsession, and nested conditionals, each with before/after examples. - Structural Refactoring Patterns: Covers extract method, strategy pattern, chain of responsibility, guard clauses, and introducing type safety with TypeScript-style domain types. - Safe Refactoring Process: Enforces a prepare-identify-refactor-verify workflow requiring tests, small commits, and behavior preservation at every step. - Use Case: A developer inherits a 200-line order processing function with nested conditionals and duplicated discount logic. Use this Skill to break it into focused functions, extract shared discount rates, and apply guard clauses while keeping all tests green. ## Quick Start Ask the agent to refactor a specific function or file to reduce duplication and improve readability without changing its behavior.