What problem does it solve?
This Skill eliminates the guesswork and regression risk of refactoring complex, hard-to-maintain code by providing step-by-step, behaviour-preserving refactoring plans with measurable complexity reduction targets.
Core Features & Use Cases
- Quantified Refactoring Plans: Calculates exact cyclomatic and cognitive complexity before and after each refactoring step, with clear effort estimates and risk ratings.
- Multi-Language Pattern Catalog: Includes before/after examples and AST-based codemod recipes for 7 languages (C#, Java, Python, C, C++, TypeScript, SQL) aligned with Fowler's refactoring best practices.
- Safety Guardrails: Enforces an 80% test coverage prerequisite before recommending refactors, and grades finding severity based on impact to current development workflows.
- Use Case: For a 95-LOC payment processing function with a cyclomatic complexity of 18 and 4 levels of nested conditionals, use this skill to get a plan that reduces complexity by 75%, includes guard clause extractions, and provides a libCST codemod for repeated conditional patterns across the codebase.
Quick Start
Use the complexity-reducer skill to generate a refactoring plan for the complex validate_order function in src/orders/validator.py, including quantified complexity metrics and codemod recipes for repeated type-checking conditionals.