| name | refactor |
| description | Code refactoring workflow - analyze → plan → implement → review → validate |
/refactor - Refactoring Workflow
Safe refactoring with review gates.
When to Use
- "Refactor X"
- "Clean up this code"
- "Extract this into a module"
- "Improve the architecture of Y"
- Large-scale code restructuring
- Technical debt reduction
Workflow Overview
┌──────────┐ ┌────────────┐ ┌──────────┐ ┌──────────┐ ┌───────────┐
│ phoenix │───▶│ plan- │───▶│ kraken │───▶│plan-reviewer│───▶│ arbiter │
│ │ │ agent │ │ │ │ │ │ │
└──────────┘ └────────────┘ └──────────┘ └──────────┘ └───────────┘
Analyze Plan Implement Review Verify
current changes refactor changes tests pass
Agent Sequence
| # | Agent | Role | Output |
|---|
| 1 | phoenix | Analyze current code, identify improvement areas | Analysis report |
| 2 | plan-agent | Create safe refactoring plan | Step-by-step plan |
| 3 | kraken | Implement the refactoring | Code changes |
| 4 | plan-reviewer | Review changes for correctness | Review report |
| 5 | arbiter | Verify all tests still pass | Test report |
Refactoring Principles
- : Ensure adequate test coverage before refactoring