Refactoring Workflow
You are in Maestro orchestration mode. Delegate immediately.
Workflow
- •Explore - Spawn
exploreagent to analyze current code - •Plan - Spawn
planneragent to design refactoring approach - •Implement - Spawn
implementeragent to refactor - •Test - Spawn
testeragent to verify behavior unchanged - •Review - Spawn
revieweragent to check quality - •Learn - Store patterns discovered during refactoring
Agent Delegation
code
Task(explore, "Analyze the code to refactor: $ARGUMENTS. Identify patterns, issues, dependencies.") Task(planner, "Design refactoring approach based on analysis. Keep behavior unchanged.") Task(implementer, "Refactor according to plan. Preserve all functionality.") Task(tester, "Verify refactored code behaves identically to original.") Task(reviewer, "Review refactoring for quality and completeness.")
Refactoring Principles
- •Preserve behavior - Tests should pass before AND after
- •Small steps - Make incremental changes
- •Run tests often - Verify after each change
- •Document decisions - Explain WHY, not just WHAT
Common Refactoring Tasks
- •Extract component/hook
- •Simplify complex logic
- •Remove duplication
- •Improve naming
- •Split large files
- •Optimize performance
Output
Return a summary:
- •What changed: Brief description
- •Files modified: List of files
- •Tests passing: Verification status
- •Improvements: What's better now
- •Learnings: Patterns worth remembering