behavior-preservation-checker

Compare code versions to verify behavioral equivalence after refactoring.

1|2|Updated Mar 10, 2026
One-click install
npx skills add https://github.com/santosomar/general-secure-coding-agent-skills --skill behavior-preservation-checker-santosomar
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: behavior-preservation-checker
Source: https://github.com/santosomar/general-secure-coding-agent-skills/tree/main/skills/code-quality/behavior-preservation-checker
Command: npx skills add https://github.com/santosomar/general-secure-coding-agent-skills --skill behavior-preservation-checker-santosomar

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill verifies that code refactoring or transformations have not altered the observable behavior of the software, preventing regressions and ensuring functional equivalence between code versions.

Core Features & Use Cases

  • Behavioral Equivalence Verification: Compares outputs and side effects of old and new code versions on given inputs.
  • Supports Multiple Verification Methods: Includes differential testing, golden-master/snapshot testing, side-effect capture, and property-based equivalence.
  • Use Case: After refactoring a critical API endpoint, use this Skill to run a suite of production-like inputs against both the old and new code to confirm that the responses and any database interactions remain identical.

Quick Start

Use the behavior-preservation-checker skill to verify that the refactored code in the 'new_version' branch behaves identically to the code in the 'main' branch using a sample of 1000 production inputs.

Frequently Asked Questions about behavior-preservation-checker

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I verify behavior preservation after refactoring code?

Behavior preservation verification works by executing both the old and new code versions against identical inputs, then comparing their outputs and side effects against a defined equivalence relation to detect any functional regressions caused by the refactoring.

What is the best way to check for regressions during automated code transformations?

The best way to check for regressions during automated code transformations is differential testing, where you execute both code versions and compare their I/O captures and side effects to ensure the structural changes do not break functionality.

Can I use differential testing to validate pre-merge pull request reviews for structural changes?

Yes, you can use differential testing for pre-merge pull request reviews by running production-like inputs against both the original and modified code branches to confirm that their responses and database interactions remain identical before merging.

Does behavior verification work without setting up an environment to execute both code versions?

No, behavior verification requires the ability to execute both code versions and compare their outputs and side effects. Without an environment capable of running the old and new code against identical inputs, equivalence cannot be validated.

What methods are available for side-effect capture and equivalence checking during post-refactoring validation?

Available methods for side-effect capture and equivalence checking include differential testing, golden-master or snapshot testing, side-effect capture, and property-based equivalence, allowing you to compare outputs and database interactions between code versions.