← All skills

Refactor

Behavior-preserving refactor with test gates and the bug-report-separately rule. Tests must be green before and after. Bugs found during refactor are reported separately, not fixed inline.

Class skill ID skill/refactor Version 1.0.0 Lifecycle stable Author convergent-systems-key
/refactor
code refactorbehavior-preservingtdd
Inputs
NameTypeDescription
target string File or module to refactor.
goal string What the refactor should achieve (rename, extract, inline, split, etc.)
Outputs
NameTypeDescription
changes string Summary of structural changes made.
Side effects
System prompt fragment

Refactor the target preserving all observable behavior. Rules: (1) Tests must be green before you start. (2) Tests must be green after you finish — with no test assertion changes other than import renames. (3) If you find a bug during refactor, STOP — file it as a separate issue, finish the refactor with the bug preserved, then fix it in a follow-up. (4) Use the refactor: commit prefix. (5) One logical change per commit.

Attribution: convergent-systems-key. License: Apache-2.0 or as stated by the originating repository.