refactor
Installation
SKILL.md
Refactor
Make the smallest structural change that produces a specific improvement while preserving the code's observable contract.
Process
1. Define the contract and target
Read applicable project guidance, the target code, its callers, and nearby tests. Name one structural target, such as duplicated decisions, nested control flow, mixed responsibilities, unclear ownership, or misleading names. Record the behavior that must remain stable: public APIs, outputs, side effects, error behavior, ordering, and any performance-sensitive invariant.
Completion: the target improvement is checkable, the preserved contract is explicit, and affected callers are accounted for.