worktrees:orchestrator
Use for multi-subagent parallel development. A main Claude instance manages multiple concurrent subagents, each working in isolated worktrees. Invoke with "/worktrees:orchestrator <feature>" or when user mentions "orchestrate agents", "parallel subagents", "coordinate development", "multi-agent workflow", "spawn subagents", or "divide feature into tasks".
What this skill does
# Orchestrator Workflow
Coordinate multiple subagents working in parallel on isolated worktrees.
## Architecture
```
Orchestrator (main worktree)
├── Manages feature branch
├── Creates/assigns worktrees
├── Monitors progress
├── Merges work
└── Handles cleanup
Subagent 1 (worktree-1) Subagent 2 (worktree-2) Subagent 3 (worktree-3)
├── Works on auth ├── Works on API ├── Works on UI
└── Commits to branch └── Commits to branch └── Commits to branch
```
## Risk Assessment
**CRITICAL: Before parallelizing, evaluate task independence.**
### Questions to Ask
- Do tasks modify any of the same files?
- Are there shared configuration dependencies?
- Do tasks extend the same interfaces/types?
- Is there a temporal dependency?
### Red Flags for Serialization
| Risk | Problem | Solution |
|------|---------|----------|
| Same config files | Merge conflicts | Assign to one subagent or orchestrator |
| Same base classes | Interface conflicts | Define interfaces first, serialize extension |
| Shared state | Race conditions | Serialize or define clear boundaries |
| Database migrations | Order dependency | Run sequentially |
### Good Decomposition
- Each task modifies **distinct files/directories**
- Minimal dependencies between tasks
- Clear interfaces between components
- Testable in isolation
## Agent Roles
### Orchestrator (You)
- **Architect**: Decomposes feature into independent tasks
- **Coordinator**: Creates worktrees and assigns tasks
- **Monitor**: Tracks progress and detects conflicts early
- **Integrator**: Merges work in correct order
- **Cleaner**: Removes worktrees and branches
### Subagents (Task tool spawned)
- **Builder**: Implements assigned scope only
- **Tester**: Writes and runs tests for their component
- **Documenter**: Adds relevant documentation
- **Reporter**: Notifies completion with clear status
## Procedure
### Phase 1: Setup
#### 1.1 Prepare Main Branch
```bash
git checkout main
git pull origin main
```
#### 1.2 Ensure Gitignore
```bash
grep -q "^\.worktrees" .gitignore 2>/dev/null || echo ".worktrees/" >> .gitignore
git add .gitignore && git commit -m "chore: add .worktrees to gitignore"
```
#### 1.3 Create Feature Branch
```bash
git checkout -b feature/<feature-name>
git push -u origin feature/<feature-name>
```
#### 1.4 Decompose Feature
Identify independent tasks. Example:
```
Feature: User Management System
├── Task 1: Authentication (src/auth/*)
├── Task 2: User API (src/api/users/*)
├── Task 3: User UI (src/components/user/*)
└── Task 4: Database migrations (migrations/*)
```
#### 1.5 Create Worktrees
```bash
git worktree add -b feature/<feature>-auth .worktrees/auth feature/<feature-name>
git worktree add -b feature/<feature>-api .worktrees/api feature/<feature-name>
git worktree add -b feature/<feature>-ui .worktrees/ui feature/<feature-name>
# Verify
git worktree list
```
### Phase 2: Task Assignment
Use the **Task tool** to spawn subagents with clear assignments.
#### Task Assignment Template
```markdown
## Task Assignment
**Worktree Path:** .worktrees/<name>
**Branch:** feature/<feature>-<component>
**Base Branch:** feature/<feature-name>
### Scope
<Specific files/directories to modify>
### Boundaries
- Only modify files in <path>/
- Do not modify shared configurations
- Interface via <exported types/functions>
### Dependencies
<Other tasks this depends on, or "None">
### Deliverables
- [ ] <Specific deliverable 1>
- [ ] <Specific deliverable 2>
- [ ] Unit tests
- [ ] Commits pushed to branch
### Completion Signal
Notify when all deliverables complete.
```
#### Using Task Tool
```typescript
// Spawn subagent for auth task
Task({
prompt: `## Task: Authentication Module
**Worktree:** .worktrees/auth
**Branch:** feature/user-mgmt-auth
### Scope
Implement AuthService in src/auth/:
- JWT token generation/validation
- Password hashing with bcrypt
- Session management
### Boundaries
- Only modify src/auth/*
- Export AuthService interface for API layer
### Deliverables
- AuthService with login/logout/validateToken
- Unit tests in tests/auth/
- Commits pushed
Navigate to worktree and begin implementation.`,
subagent_type: "general-purpose"
});
```
### Phase 3: Monitoring
#### Check Progress
```bash
# Worktree status
git worktree list
# Branch activity
git log --oneline -5 feature/<feature>-auth
git log --oneline -5 feature/<feature>-api
# Recent commits across all
git log --oneline --all --since="1 hour ago"
```
#### Detect Conflicts Early
```bash
# Dry-run merge
git merge --no-commit --no-ff feature/<feature>-auth
git merge --abort # Cancel
# Or use merge-tree
git merge-tree $(git merge-base HEAD feature/<feature>-auth) HEAD feature/<feature>-auth
```
### Phase 4: Integration
#### Merge Order
Merge in dependency order (e.g., DB → Auth → API → UI):
```bash
git checkout feature/<feature-name>
# Merge each component
git merge feature/<feature>-db --no-ff -m "Merge database migrations"
npm test # Verify
git merge feature/<feature>-auth --no-ff -m "Merge authentication"
npm test # Verify
git merge feature/<feature>-api --no-ff -m "Merge API endpoints"
npm test # Verify
git merge feature/<feature>-ui --no-ff -m "Merge UI components"
npm test # Full integration test
```
#### Conflict Resolution
If conflicts occur:
```bash
# See conflicting files
git status
# Resolve conflicts (edit files, remove markers)
git add <resolved-files>
git commit -m "Merge feature/<feature>-api, resolve config conflict"
```
**Common conflict patterns:**
- Shared configs → Have orchestrator handle or assign to one subagent
- Import statements → Combine in logical order
- Type definitions → Merge types, ensure no overlap
### Phase 5: Cleanup
```bash
# Remove worktrees
git worktree remove .worktrees/auth
git worktree remove .worktrees/api
git worktree remove .worktrees/ui
# Prune
git worktree prune
# Delete local branches
git branch -d feature/<feature>-auth
git branch -d feature/<feature>-api
git branch -d feature/<feature>-ui
# Delete remote branches
git push origin --delete feature/<feature>-auth
git push origin --delete feature/<feature>-api
git push origin --delete feature/<feature>-ui
```
## Plan Mode for Subagents
Recommend subagents use Plan Mode for complex tasks:
```markdown
### Working Method
Start in Plan Mode for safe exploration:
1. Analyze existing code in scope area
2. Design implementation approach
3. Identify any shared file concerns
4. Exit Plan Mode when approach is clear
5. Implement following the plan
```
## Desktop Organization Tips
For visual orchestration with multiple windows:
- **One Space/Desktop per worktree** - Quick switching
- **Consistent layout**: IDE left, Claude right
- **Keyboard shortcuts** for rapid navigation
- **Separate terminal tabs** per worktree
## Error Handling
### Subagent Fails to Complete
```bash
# Check status
cd .worktrees/<name>
git status
git log --oneline -3
# Options:
# 1. Reassign to different subagent
# 2. Orchestrator completes task
# 3. Abandon and adjust scope
# If abandoning:
cd ../.. # Return to main
git worktree remove --force .worktrees/<name>
git branch -D feature/<feature>-<name>
```
### Merge Failure Midway
```bash
# Abort current merge
git merge --abort
# Reset to pre-integration
git reflog # Find commit
git reset --hard <pre-integration-commit>
# Re-attempt with different strategy
```
### Worktree Corruption
```bash
git worktree remove --force .worktrees/<name>
git worktree prune
git worktree add -b feature/<feature>-<name> .worktrees/<name> feature/<feature-name>
```
## Checklist
### Setup Phase
- [ ] Main branch up to date
- [ ] `.worktrees/` in `.gitignore`
- [ ] Feature branch created and pushed
- [ ] **Risk assessment completed**
- [ ] Tasks decomposed into independent units
- [ ] Worktrees created with descriptive names
- [ ] Task assignments documented
### Execution Phase
- [ ] Subagents spawned with Task tool
- [ ] Progress monitored regularRelated in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.