# refactor > Restructure code without changing behavior: safety net first, then transform - Author: 靳春元 - Repository: Ydy4HYW7ExA/claude-habitat - Version: 20260208141437 - Stars: 5 - Forks: 0 - Last Updated: 2026-02-08 - Source: https://github.com/Ydy4HYW7ExA/claude-habitat - Web: https://mule.run/skillshub/@@Ydy4HYW7ExA/claude-habitat~refactor:20260208141437 --- --- name: "refactor" description: "Restructure code without changing behavior: safety net first, then transform" --- # Refactor > Safety net first. Transform second. Verify always. ## Trigger - User asks to "refactor" or "restructure" - Code smells identified during review - Workflow phase: Design (for refactor-type workflows) ## Protocol @import refactor/context @import refactor/protocol @import refactor/gates @import shared/coding/tool-use @import shared/coding/principles @import shared/coding/coherence @import shared/coding/patterns/index