refactor-guardian

Verify code refactors preserve behavior and public interfaces.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/Hawi254/transport_tycoon_sim --skill refactor-guardian
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor-guardian
Source: https://github.com/Hawi254/transport_tycoon_sim/tree/main/.agent/skills/refactor-guardian
Command: npx skills add https://github.com/Hawi254/transport_tycoon_sim --skill refactor-guardian

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Refactor operations can unintentionally alter behavior or break public interfaces; this skill provides guardrails that verify refactors are safe by construction.

Core Features & Use Cases

  • Validates refactor intent and scope to prevent regressions.
  • Enforces no-behavior-change contracts across code movement, module extraction, renaming, and architectural restructuring.
  • Collects real artifacts (builds, tests, diffs) via terminal access and compares pre- and post-change behavior.
  • Generates actionable remediation guidance and can write helper scripts to automate repetitive checks.
  • Applies to large-scale restructuring before merges, providing a last-line safety net.

Quick Start

Run the guardian automatically during refactors to verify behavioral equivalence and public API stability.

Frequently Asked Questions about refactor-guardian

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

FAQPage Schema
How do I verify behavioral equivalence when refactoring code?

Verify behavioral equivalence during refactoring by enforcing no-behavior-change contracts, collecting real build and test artifacts via terminal access, and comparing pre- and post-change states to detect any regressions.

When do I need to validate API stability during module extraction?

Validate API stability during module extraction, renaming, or architectural restructuring to ensure public interfaces remain unchanged. Apply automated guardrails during these operations to detect interface changes and prevent unauthorized contract modifications.

How do I check that code movement preserves behavior before a merge?

Check that code movement preserves behavior by running automated guardrails that enforce hard constraints and collect artifacts from builds and tests. This generates a structured report with actionable remediation guidance for any detected changes.

Does refactor verification work for large-scale architectural restructuring?

Refactor verification works for large-scale architectural restructuring by acting as a last-line safety net before merges. It validates refactor intent and scope to prevent regressions across complex code movement and module extraction operations.

What is the best way to detect persistence and interface changes during refactoring?

The best way to detect persistence and interface changes during refactoring is to apply hard constraints that validate refactor intent, collect real artifacts, and output a structured report detailing behavioral, interface, and persistence modifications.