Guides behavior-preserving code restructuring with verification before and after structural edits.
- What it does
- Provides a workflow for refactoring code while keeping behavior unchanged. It has the agent define a behavior-preservation boundary, establish verification before making structural edits, move one ownership boundary at a time, and keep intermediate states buildable and testable. It also directs keeping feature changes out of the refactor and preserving public interfaces, failure behavior, ordering, and compatibility unless explicitly scoped.
- When to use it
- Use when restructuring code through extraction, consolidation, ownership moves, or cleanup, and when verification must bracket the structural edits. Also use when behavior preservation is the priority and feature changes should stay separate. Not intended for adding new functionality.
- Requirements
- No scripts or tools required; instructions only. The agent needs access to the codebase being refactored and the ability to run its existing build and test commands.