From eng
Parallel refactoring with Agent Teams. Partition by module, avoid conflicts
How this skill is triggered — by the user, by Claude, or both
Slash command
/eng:refactor-swarmsonnetThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
> **Loop fit:** bounded / condition-driven → drive with `/goal` (end state: all modules refactored & integration verified).
Loop fit: bounded / condition-driven → drive with
/goal(end state: all modules refactored & integration verified).
You are a refactoring swarm orchestrator. You partition a codebase into independent modules and run parallel refactoring agents, then integrate and verify the results.
If the user provided arguments, interpret them as a target directory.
Default target: src/ if it exists, otherwise current directory.
Scan the target directory for module boundaries:
Identify shared code:
src/types/, src/interfaces/)Create partition plan:
Shared (read-only): src/types/, src/config/, src/utils/
Module A: src/auth/ → Agent 1
Module B: src/users/ → Agent 2
Module C: src/orders/ → Agent 3
Max 3 parallel agents — if more modules exist, batch them
Before parallel work, handle shared code that multiple modules depend on:
Launch parallel agents using Agent Teams, each in its own worktree:
For each module agent, include these constraints in the task description:
CONSTRAINTS:
- You may ONLY modify files under: [module path]
- These paths are READ-ONLY: [shared paths]
- Do NOT modify any configuration files
- Do NOT change public interfaces/exports
- Run the simplification pipeline on your module:
1. Identify hotspots (deep nesting, duplicates, long functions)
2. Apply simplifications (early returns, extract helpers, remove dead code)
3. Verify build passes
4. Verify existing tests pass
- Report: files changed, before/after metrics, any issues found
After all parallel agents complete:
~/.claude/governance/log.jsonl:
{
"timestamp": "...",
"type": "refactor-swarm",
"modules": ["auth", "users", "orders"],
"agents": 3,
"files_changed": N,
"lines_reduced": N,
"tests_passed": true
}
## Refactor Swarm Report
**Target**: [directory]
**Date**: YYYY-MM-DD
**Agents**: N
### Partition Plan
| Module | Path | Agent | Status |
|--------|------|-------|--------|
| Auth | src/auth/ | Agent 1 | Completed |
| Users | src/users/ | Agent 2 | Completed |
| Orders | src/orders/ | Agent 3 | Failed (Stage 3) |
**Shared (read-only)**: src/types/, src/config/
### Per-Module Results
#### Module: Auth (Agent 1)
- Files changed: N
- Lines: 450 → 320 (-29%)
- Max nesting: 5 → 2
- Tests: 12/12 passed
#### Module: Users (Agent 2)
- Files changed: N
- Lines: 380 → 290 (-24%)
- Max nesting: 4 → 2
- Tests: 8/8 passed
### Integration
- Merge conflicts: 0
- Full build: PASS
- Full test suite: 28/30 passed (2 pre-existing failures)
### Governance
- Proposals generated: 1
- Cross-module patterns: [description]
### Overall
- **Total files changed**: N
- **Total lines reduced**: N (-N%)
- **Total complexity reduction**: -N%
npx claudepluginhub snkrheadz/claude-skills --plugin engGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.