behavior-preservation-checker
Installation
SKILL.md
Behavior Preservation Checker
"It's just a refactor" is a claim. This skill checks the claim: does the new code produce the same observable behavior as the old code on the inputs that matter?
Approaches — cheapest to strongest
| Approach | Checks | Cost | Confidence |
|---|---|---|---|
| Run the existing tests | Whatever the tests assert | Free | As good as your test suite — often not very |
| Differential testing | Old and new produce same output on random/prod inputs | Low | High where you can enumerate inputs |
| Golden-master / snapshot | Output matches a recorded baseline byte-for-byte | Low | Very high for serialized output; brittle |
| Side-effect capture | Same DB writes, same HTTP calls, same log lines | Medium | Catches effects tests usually miss |
| Property-based equivalence | ∀x. old(x) == new(x) over generated inputs |
Medium | High for pure functions |
| Formal equivalence proof | Proven equal by construction | High | Absolute — → semantic-equivalence-verifier |
Use the cheapest one that gives you the confidence you need. Differential testing covers 90% of cases.