What problem does it solve? Codebases accumulate technical debt: long methods, duplicated logic, deep nesting, and SOLID violations that make changes risky and slow. This Skill provides a methodical, test-guarded process for improving code structure without changing external behavior. ## Core Features & Use Cases - Code Smell Detection: Identifies 14+ classic smells such as long methods, large classes, duplicated code, feature envy, and primitive obsession, each mapped to a concrete refactoring technique. - Proven Refactoring Patterns: Provides before/after Python examples for extract method, extract class, replace conditional with polymorphism, parameter objects, guard clauses, and Python 3.12+ idioms like match-case and the walrus operator. - Safety-First Process: Enforces a SAFE workflow (small steps, automated tests, frequent commits, explained changes) with checklists and characterization tests to guarantee behavior preservation. - Use Case: A developer inherits a 200-line function with nested conditionals and no tests. The Skill guides writing characterization tests first, then applying extract method and guard clauses step by step, verifying tests pass after each change. ## Quick Start Ask the agent to refactor the long process_order function in checkout.py using extract method while keeping all tests passing.