refactoring
Installation
SKILL.md
Refactoring Skill
Activate this skill when restructuring existing code, eliminating duplicates, modernizing patterns, decomposing monolithic functions, or pruning dead code.
Refactoring Law: Refactoring improves the internal structure of software without altering its external observable behavior.
1. Safety & Baseline Invariants
Before modifying any existing implementation:
- Verify Baseline Tests: Run existing test suites (
npm test,pytest,cargo test) and confirm that all tests pass before making any changes. - Preserve Public API Contracts: Never alter exported function signatures, route parameters, or database schemas without a documented deprecation plan and updating all internal call sites.
- Atomic, Incremental Changes: Refactor in small, verifiable steps. Never attempt large-scale rewrites in a single unverified commit.