What problem does it solve? Python codebases accumulate overly complex functions, deeply nested logic, and long files that are hard to maintain and test. This Skill measures cyclomatic and cognitive complexity, identifies the worst offenders, and applies proven refactoring patterns to simplify the code safely. ## Core Features & Use Cases - Complexity Measurement: Uses tools like pyscn, radon, lizard, complexipy, xenon, and wily to score functions and track complexity trends over time. - Refactoring Patterns: Provides concrete patterns including extract function, guard clauses, lookup tables, comprehensions, magic number extraction, and type alias consolidation. - Safety-First Workflow: Enforces prerequisites like full test coverage and a clean git tree before refactoring, plus a verification checklist afterward. - Use Case: A developer runs pyscn on a legacy module, finds a function with cognitive complexity of 25, and uses the extract-function and guard-clause patterns to bring it under the threshold while keeping all tests green. ## Quick Start Analyze this Python project for overly complex functions and refactor the worst ones while keeping all tests passing.