/refactor
Refactor code by finding files, grouping them, and launching parallel Snipper agents.
Refactor code across multiple files using parallel Snipper agents.
Usage
BASH
/refactor rename getUserData to fetchUserProfile
/refactor convert class components to functional
/refactor extract common validation logicWorkflow
1. Discovery
- Parse the refactor request
- Find all affected files (Grep/Glob)
- Analyze scope (confirm if >15 files)
2. Create Instructions
- Generate unique task ID
- Create
.claude/tasks/refactor-{id}/ - Write ONE
instructions.mdwith:- Clear objective
- What to change
- How to change
- Rules to follow
3. Launch Parallel Agents
- Batch files (max 3 per agent)
- Launch Snipper agents in parallel
- Pass instructions file path
4. Collect Results
- Wait for all agents to complete
- Verify all files modified
- Report summary
File Batching
| Total Files | Batches | Agents |
|---|---|---|
| 1-3 | 1 | 1 Snipper |
| 4-9 | 2-3 | 2-3 Snippers |
| 10-15 | 3-5 | 3-5 Snippers |
Output
Refactored 12 files:
- src/auth/*.ts: Updated function names
- src/api/*.ts: Extracted validation logic
Priority
Consistency > Speed. All files refactored identically.