1.1 KiB
1.1 KiB
description, argument-hint, subagent, fork
| description | argument-hint | subagent | fork |
|---|---|---|---|
| Safely restructure code without changing behavior | [file path or symbol to refactor] | true | true |
Refactor: $@
Structure your answer as:
- Current shape — what this code does today, in terms of responsibilities (not lines)
- Target shape — what the refactor preserves externally (behavior, API, output) and what it improves internally (readability, coupling, testability, reuse)
- Why this is safe — the test/contract that proves the refactor doesn't change behavior. If none exists, STOP and recommend
p-testfirst. - Step-by-step mechanical changes — numbered, each one individually committable and runnable
- After each step — the command to run (test, type-check, lint) to confirm green
- Final verification — full test suite, plus any manual smoke check
- Rollback — how to revert each step in isolation (e.g. one commit = one rollback unit)
Do not combine refactor with new features. Do not change behavior "while you're in there." If you spot a bug or a missing test, call it out separately at the end, do not fix it inline.