Overview
/silver:refactor is the Silver Bullet orchestrator for structural code changes that preserve behavior — module extraction, dependency inversion, naming cleanup, dead-code removal, and architecture realignment without new features. It maps to catalog entity WF-SILVER-REFACTOR (specialized type) in the v0.48.3 APO catalog.
Refactor skips upfront clarify/specify atoms because behavior is frozen — the risk is in blast radius of structural moves, not requirements ambiguity. After execution, it runs the same post-execution gate sequence as feature work.
Standard composition:
The post-execution sequence is the catalog's review, verify, secure, and ship gates — expanded as atomic flows above, not a separate user-facing workflow name. See Post-Execution Sequencing.
/silver:feature instead. Refactor assumes existing tests are the parity contract.
When to Use
Entry trigger signals for /silver:refactor and refactor:
- Module extraction, package reorganization, or layer boundary cleanup
- Rename sweeps, dead-code removal, or dependency graph simplification
- Pattern migration (callbacks → async/await, class → functional) with parity tests
- Technical debt paydown that touches multiple files but adds no features
Catalog Composition
| Phase | Atomic flows | Outcome |
|---|---|---|
| Pre-execution | AF-PLAN → AF-EXECUTE → AF-VERIFY | Refactor plan, structural changes, parity verification |
| Review gates | AF-REVIEW-REQUEST → AF-REVIEW → AF-REVIEW-TRIAGE | Artifact review, triage, and fix loop |
| Ship gates | AF-VERIFY → AF-SECURE → AF-VALIDATE → AF-QUALITY-GATE → AF-BRANCH-FINISH → AF-COMPLETION-AUDIT → AF-SHIP | Final verification, security, quality gate, branch hygiene, ship |
Post-Execution Gates
After AF-EXECUTE completes, the refactor workflow expands into the canonical post-execution gate chain shared with /silver:feature and /silver:bugfix:
- Review gates —
AF-REVIEW-REQUEST,AF-REVIEW,AF-REVIEW-TRIAGEfor structural change review - Verify gate —
AF-VERIFYconfirms full test suite and no behavior regression - Secure gate —
AF-SECUREfor security-sensitive structural moves (auth paths, crypto, input handling) - Ship gates —
AF-VALIDATE, pre-shipAF-QUALITY-GATE,AF-BRANCH-FINISH,AF-COMPLETION-AUDIT,AF-SHIP
AF-UI-QUALITY inserts only when runtime evidence shows UI deliverables in scope.
Example Invocation
Silver Bullet routes to WF-SILVER-REFACTOR. Planning documents module boundaries and migration steps. Execution moves code with import updates. Initial verify confirms test parity. Review gates examine structural diff. Ship gates pass and the refactor merges.