Git worktrees, multi-agent coordination, vertical slicing. Use when setting up parallel development workflows, splitting work across Claude instances, or coordinating merges from multiple workstreams.
<why_now>
Complex projects benefit from multiple agents working simultaneously on different features. Git worktrees enable this by creating separate working directories that share the same repository, allowing:
The key insight: Claude instances can work in parallel just like human developers, but they need the right coordination patterns to avoid stepping on each other. </why_now>
<core_principles>
Split work by feature slice, not layer:
✗ Horizontal (conflicts guaranteed):
Worktree A: All backend changes
Worktree B: All frontend changes
✓ Vertical (minimal conflicts):
Worktree A: User auth (frontend + backend + tests)
Worktree B: Billing (frontend + backend + tests)
Test: Can both worktrees be merged independently without code conflicts?
Each worktree should touch different files:
Phase 1 Files Phase 2 Files Phase 3 Files
───────────── ───────────── ─────────────
.claude/skills/ .claude/skills/ .claude/commands/
mcp-tool-design/ agent-testing/ release.md
.claude/agents/ .claude/agents/ roadmap.md
mcp-*.md parity-*.md .claude/skills/
deployment-ops/
Test: Do file paths overlap between worktrees?
Main branch is the integration target, never the work surface:
feature-auth ──┬──> main (integration) <──┬── feature-billing
│ │
└─────── merge ────────────┘
Test: Is anyone coding directly on main?
Merge to main often to avoid divergence:
✗ Big bang merge (risky):
Week 1: Work → Week 2: Work → Week 3: Work → Week 4: Merge chaos
✓ Incremental merge (safe):
Day 1: Work → Merge → Day 2: Work → Merge → Day 3: Work → Merge
Test: How long since the last merge to main?
Structure the work so coordination happens through the system, not conversation:
✗ "Hey, I'm about to edit utils.js, don't touch it"
✓ utils.js only exists in one worktree's slice
Test: Does parallel work require active coordination? </core_principles>
<two_phase_workflow>
Parallel development is split into two distinct phases:
/plan — Strategic Planning/plan
Handles the thinking part:
AskUserQuestion.parallel-plan.md with slice definitions and skill recommendations/execute — Mechanical Execution/execute
Handles the doing part:
.parallel-plan.md.claude-task.md files with full specs--dangerously-skip-permissionsCOMPLETE: commits┌─────────────────────────────────────────────────────────────────────┐
│ /plan │
├─────────────────────────────────────────────────────────────────────┤
│ 1. Enter plan mode (safe exploration) │
│ 2. Analyze PRD and codebase │
│ 3. Clarify requirements with user │
│ 4. Generate feature specs (JTBD, design, UX, architecture) │
│ 5. Update PRD with completion markers │
│ 6. Write .parallel-plan.md with slices + skill recommendations │
└───────────────────────────────┬─────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────┐
│ /execute │
├─────────────────────────────────────────────────────────────────────┤
│ 1. Read .parallel-plan.md │
│ 2. Create worktrees for each slice │
│ 3. Write .claude-task.md with full specs │
│ 4. Spawn agents (--dangerously-skip-permissions) │
│ 5. Monitor for COMPLETE: commits │
└───────────────────────────────┬─────────────────────────────────────┘
│
┌──────────────────────┼──────────────────────┐
▼ ▼ ▼
┌─────────┐ ┌─────────┐ ┌─────────┐
│ Agent 1 │ │ Agent 2 │ │ Agent 3 │
│ Slice A │ │ Slice B │ │ Slice C │
└─────────┘ └─────────┘ └─────────┘
│ │ │
└──────── All commit "COMPLETE:" ────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────┐
│ /execute merge │
├─────────────────────────────────────────────────────────────────────┤
│ 1. Verify all COMPLETE: commits │
│ 2. Merge branches to main │
│ 3. Update PRD (🔄 → ✅) │
│ 4. Clean up worktrees and branches │
└─────────────────────────────────────────────────────────────────────┘
| Aspect | Single Command | Two-Phase | |--------|---------------|-----------| | Iteration | Hard to adjust mid-spawn | Plan phase allows iteration | | PRD sync | Manual | Automatic status updates | | Clarity | Prompt generated on-the-fly | Plan file is reviewable | | Resume | Start over if interrupted | Execute from existing plan | | Audit trail | None | PRD history + plan files | </two_phase_workflow>
<automated_spawning>
Background agents with --dangerously-skip-permissions work autonomously in isolated worktrees. PR review is the safety net.
Each worktree gets a .claude-task.md file with full specifications from the plan:
# Task: [Slice Name]
You are working in worktree: [path]
Branch: [branch-name]
## Recommended Skills
- `frontend-design` — For distinctive visual design
- `atomic-design-system` — Component hierarchy patterns
## Jobs to be Done
| Job Type | Description |
|----------|-------------|
| **Functional** | [What user needs to accomplish] |
| **Emotional** | [How user wants to feel] |
| **Success** | [Measurable outcome] |
## Design Spec
**Layout**: [Description]
**Component Hierarchy**: [Tree structure]
**State Variations**: Loading, Empty, Error, Success
## UX Architecture
**User Flow**: [Step-by-step]
**Interactions**: [Click, hover, drag behaviors]
## Technical Architecture
**File Structure**: [Directory layout]
**State Management**: [Approach]
**Data Flow**: [Source → Transform → Render]
## Files You Own
- [List of files/directories]
## Frozen Files (DO NOT MODIFY)
- [List of shared files]
## Success Criteria
- [ ] [Criterion 1]
- [ ] [Criterion 2]
- Commit: "COMPLETE: [description]"
Begin working now. Read the recommended skills first.
cd [worktree-path] && claude --dangerously-skip-permissions -p "$(cat .claude-task.md)" &
Agents signal completion by committing with message starting with "COMPLETE:".
Check via: git log -1 --oneline | grep "COMPLETE:"
.parallel-plan.mdWait for response before proceeding. </intake>
<routing> | Response | Action | |----------|--------| | 1, "plan", "start", "new" | Run `/plan` — Strategic planning with detailed feature specs | | 2, "execute", "spawn", "run" | Run `/execute` — Creates worktrees and spawns agents | | 3, "status", "check", "progress" | Run `/execute status` — Shows worktree and agent progress | | 4, "merge", "done", "complete" | Run `/execute merge` — Merges all completed branches | | 5, "sync", "rebase", "update" | Run `/execute sync` — Syncs worktree with main | | 6, "learn", "patterns", "help" | Read references: [vertical-slicing.md](./references/vertical-slicing.md), [coordination-patterns.md](./references/coordination-patterns.md) |After reading references, apply patterns to the user's specific context. </routing>
<parallel_agents>
/plan)┌─────────────────────────┐
│ Enter Plan Mode │
│ → Safe exploration │
│ → No side effects │
└───────────┬─────────────┘
│
▼
┌─────────────────────────┐
│ Discovery (parallel) │
│ → Analyze PRD │
│ → Analyze codebase │
│ → Identify patterns │
└───────────┬─────────────┘
│
▼
┌─────────────────────────┐
│ Clarification │
│ → AskUserQuestion │
│ → Resolve JTBD │
│ → Scope decisions │
└───────────┬─────────────┘
│
▼
┌─────────────────────────┐
│ Feature Specs │
│ → JTBD per feature │
│ → Design specs │
│ → UX architecture │
│ → Technical arch │
└───────────┬─────────────┘
│
▼
┌─────────────────────────┐
│ Output │
│ → Update PRD (markers) │
│ → .parallel-plan.md │
└─────────────────────────┘
/execute)┌─────────────────────────┐
│ Read .parallel-plan.md │
│ → Validate slices │
│ → Create worktrees │
│ → Write task prompts │
└───────────┬─────────────┘
│
▼
┌───────────┴───────────┬─────────────────────┐
▼ ▼ ▼
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Agent 1 │ │ Agent 2 │ │ Agent 3 │
│ Slice A │ │ Slice B │ │ Slice C │
│ (background)│ │ (background)│ │ (background)│
└──────┬──────┘ └──────┬──────┘ └──────┬──────┘
│ │ │
└── COMPLETE: ───┴── COMPLETE: ───┘
│
▼
┌─────────────────────────┐
│ /execute merge │
│ → Merge to main │
│ → Update PRD (✅) │
│ → Cleanup worktrees │
└─────────────────────────┘
</parallel_agents>
<setup_workflow>
Use the two-phase workflow for all parallel development:
# Phase 1: Plan
/plan
# → Enters plan mode
# → Analyzes codebase and PRD
# → Clarifies requirements
# → Generates feature specs
# → Outputs .parallel-plan.md
# Phase 2: Execute
/execute
# → Reads .parallel-plan.md
# → Creates worktrees
# → Spawns agents
# → Monitors for COMPLETE:
# Check progress
/execute status
# When all complete
/execute merge
/plan Produces.parallel-plan.md with detailed slice definitions:
# Parallel Development Plan
**Generated**: 2026-02-04
**Session Focus**: Canvas Foundation
## Slices
### Slice 1: Canvas Graph Core
**Branch**: feature-canvas-core
**Recommended Skills**:
- `frontend-design` — Distinctive visual design
- `atomic-design-system` — Component hierarchy
#### Jobs to be Done
| Job Type | Description |
|----------|-------------|
| **Functional** | User needs to see component dependencies |
| **Success** | Identify load-bearing components in <10s |
#### Design Spec
**Layout**: Full-viewport graph canvas
**Component Hierarchy**:
ComponentGraphPanel (organism)
├── GraphCanvas (molecule)
│ ├── GraphNode (atom)
│ └── GraphEdge (atom)
└── GraphControls (molecule)
**State Variations**: Loading, Empty, Error, Success
#### UX Architecture
**User Flow**:
1. Open Canvas tab → Loading
2. Graph renders → Zoom-to-fit
3. Hover node → Tooltip
4. Click node → Selection
#### Technical Architecture
**Files Owned**: src/components/ComponentGraph/
**Frozen**: package.json, src/lib/workspace-ui/
**Success Criteria**:
- [ ] Graph renders with 10+ nodes
- [ ] Zoom/pan works
- Commit: "COMPLETE: Canvas graph core"
---
### Slice 2: Parsing Engine
[Similar structure...]
## Merge Order
1. Slice 2 (no dependencies)
2. Slice 1 (uses parsing types)
/plan updates the PRD with standardized markers:
## Implementation Status
### ✅ Complete
| Feature | Commit | Date |
|---------|--------|------|
| Workspace Shell | abc123 | 2026-02-01 |
### 🔄 In Progress
| Feature | Branch | Notes |
|---------|--------|-------|
| Canvas Graph | feature-canvas | Running |
### 📋 Next Up
| Feature | Priority | Dependencies |
|---------|----------|--------------|
| Heatmap Overlay | P1 | Canvas Graph |
### ⏸️ Deferred
| Feature | Reason |
|---------|--------|
| Email Notifications | Not needed for v1 |
</setup_workflow>
<sync_workflow>
Run /execute sync in a worktree to stay current with main:
/execute sync
This will:
If rebase conflicts occur:
# After resolving conflicts
git add <resolved-files>
git rebase --continue
</sync_workflow>
<merge_workflow>
When all agents have committed with COMPLETE: prefix:
/execute merge
This will:
COMPLETE: commits## Parallel Merge Complete!
### Merged Branches
- feature-canvas-core: abc123 - COMPLETE: Canvas graph
- feature-parsing: def456 - COMPLETE: Parsing engine
### PRD Updated
- Canvas Graph: ✅ Complete (was 🔄)
- Parsing Engine: ✅ Complete (was 🔄)
### Next Up (per PRD)
- 📋 Heatmap Overlay
- 📋 Ghost Preview
</merge_workflow>
<reference_index>
All references in references/:
Setup & Management:
Work Division:
Coordination:
Integration:
/plan — Strategic planning: analyze codebase, clarify requirements, generate feature specs, output .parallel-plan.md/execute — Execution: create worktrees, spawn agents, monitor progress/execute status — Check agent progress/execute merge — Merge completed branches, update PRD, cleanup/execute sync — Sync worktree with main/execute clean — Remove a specific worktree
</commands>
<anti_patterns>
Horizontal slicing — Splitting by layer instead of feature
✗ "Worktree A does all backend, B does all frontend"
✓ "Worktree A does auth (full stack), B does billing (full stack)"
Overlapping slices — Multiple worktrees touching same files
✗ Both worktrees modify src/utils/helpers.js
✓ Shared utilities are frozen or split into separate files
Main as workspace — Doing development directly on main
✗ cd project && claude (working on main)
✓ cd project-feature && claude (working on feature branch)
Silent divergence — Not syncing with main for days
✗ Work for a week, then face massive merge conflicts
✓ Sync daily, merge when feature slices are complete
Cross-worktree dependencies — One worktree waiting on another
✗ "I can't start until you finish the user model"
✓ Slice work so each worktree can progress independently
Communication over convention — Relying on messages instead of structure
✗ "Don't touch api/users.js, I'm working on it"
✓ api/users.js is exclusively in one worktree's slice
Big bang merge — Saving all merges for the end
✗ All 3 worktrees merge at once on Friday
✓ Each worktree merges when its slice is complete
Merge commit avalanche — Too many merge commits cluttering history
✗ 50 merge commits for one feature
✓ Rebase feature branch, then single merge to main
Conflict avoidance — Skipping sync because conflicts are scary
✗ "I'll deal with conflicts later"
✓ Small, frequent syncs = small, easy conflicts
</anti_patterns>
<success_criteria>
You've done parallel development well when:
Can you spin up a new Claude instance in a new worktree and have it start working immediately without coordinating with other instances?
If yes, you've structured parallel development correctly. </success_criteria>
npx skills add cbarker95/parallel-development下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer