Executes safe, incremental code refactoring with mandatory test verification and regression guards to preserve existing behavior.
The Refactor skill provides a rigorous framework for restructuring code without altering its external behavior. It follows a systematic multi-phase process that includes capturing baseline metrics, mapping dependencies, studying project-specific patterns, and executing changes through atomic, verifiable steps. By running type-checks and test suites after every individual modification, the skill ensures that regressions are caught immediately and reverted, maintaining a stable build throughout the entire transformation process. It is ideal for decomposing complex modules, extracting utilities, and reducing technical debt without introducing bugs.
Key Features
01Mandatory verification using project-specific type-check and test commands
020 GitHub stars
03Pattern research phase to ensure refactored code matches existing project architecture
04Comprehensive dependency mapping to identify all affected imports and public API consumers
05Detailed code metrics tracking including cyclomatic complexity and export counts
06Incremental step-by-step execution with automatic regression detection and rollback
Use Cases
01Extracting repeated logic into shared utility functions with updated references
02Safely renaming symbols and restructuring module boundaries across the codebase
03Breaking down monolithic files into smaller, maintainable modules or components