safe-refactor

Restructures code while preserving behavior through verification-bracketed structural edits.

1|Updated May 3, 2021
One-click install
npx skills add https://github.com/leogurja/dotfiles --skill safe-refactor-leogurja
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: safe-refactor
Source: https://github.com/leogurja/dotfiles/tree/main/home/dot_agents/skills/safe-refactor
Command: npx skills add https://github.com/leogurja/dotfiles --skill safe-refactor-leogurja

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Structural code changes like extractions, consolidations, and ownership moves often introduce subtle regressions because behavior verification is skipped or done inconsistently. This Skill enforces a discipline where verification is established before edits and re-run after, so refactoring never silently changes behavior. ## Core Features & Use Cases - Behavior-Preservation Boundary: Defines what must stay unchanged—public interfaces, failure behavior, ordering, and compatibility—before any structural edit begins. - Incremental Ownership Moves: Moves one ownership boundary at a time, keeping every intermediate state buildable and testable. - Scope Discipline: Keeps feature changes, dependency growth, and configuration changes out of the refactor unless explicitly scoped. - Use Case: When splitting a monolithic module into separate packages, use this Skill to extract one component at a time, running the same test suite before and after each move to confirm identical behavior. ## Quick Start Use safe-refactor to extract this module into its own package while keeping all existing tests passing.

Frequently Asked Questions about safe-refactor

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

FAQPage Schema
Why does a refactor break tests even when logic seems unchanged?▼

Breakages usually come from changed ordering, altered failure behavior, or implicit dependency and configuration growth during the move. Preserving ordering and avoiding unscoped dependency changes prevents most of these regressions.