parallel-worktrees
БесплатноБез исполняемых скриптовНе проверенParallel development using git worktrees with Claude Code subagents. Use when spawning multiple async Claude agents across isolated worktrees, running…
от SpillwaveSolutions★ 16 звёзд на GitHubОб этом скилле
Parallel Worktrees with Claude Code Subagents
Run multiple Claude Code agents simultaneously across git worktrees to transform a single developer into a team of AI engineers. LLM non-determinism becomes an advantage: running N parallel agents produces multiple valid solutions to choose from.
Table of Contents
- Core Workflow
- Git Worktrees Essentials
- Claude Code Subagents
- Spawning Parallel Subagents
- Workflow Patterns
- Dependency Management
- Common Pitfalls
- When to Use Parallel vs Sequential
- Resource Considerations
- Background Subagents with Worktree Coordination
Core Workflow
- Create isolated worktrees for each task
- Spawn independent Claude sessions in each
- Cycle through to monitor progress and approve permissions
- Merge the best results
Git Worktrees Essentials
Worktrees create additional working directories sharing a single .git database. Unlike cloning, they save disk space and keep history unified.
Key Commands
# Create worktree with new branch from main
git worktree add ../project-feature-a -b feature-a main
# Create worktree for existing branch
git worktree add ../project-bugfix bugfix-123
# Organized subdirectory pattern (recommended)
mkdir -p .worktrees && echo ".worktrees/" >> .gitignore
git worktree add .worktrees/feature-auth -b feature/auth main
# List all worktrees
git worktree list
# Remove worktree (use --force if uncommitted changes)
git worktree remove ../project-feature-a
# Clean stale metadata
git worktree prune
Directory Patterns
Adjacent folders: my-project/, my-project-feature-a/, my-project-bugfix/
Subdirectory pattern (keeps things organized):
my-project/
├── .worktrees/
│ ├── feature-auth/
│ ├── feature-api/
│ └── bugfix-login/
└── (main working tree)
Claude Code Subagents
Subagents are specialized AI assistants with isolated context windows, custom prompts, and configurable tool access.
Built-in Subagents
| Subagent | Model | Tools | Purpose |
|---|---|---|---|
| General-Purpose | Sonnet | All (read/write) | Complex multi-step operations |
| Plan | Sonnet | Read-only | Gather info before planning |
| Explore | Haiku | Read-only | Fast code analysis |
Creating Custom Subagents
Interactive: /agents command opens management menu (recommended)
File-based: Place markdown with YAML frontmatter in:
.claude/agents/*.md(project-scoped)~/.claude/agents/*.md(user-scoped)
---
name: code-reviewer
description: Expert code review specialist. Use PROACTIVELY after changes.
tools: Read, Grep, Glob, Bash
model: inherit
---
Acts as a senior code reviewer. When invoked:
1. Run git diff to see changes
2. Focus on modified files
3. Prioritize: Critical → Warnings → Suggestions
Note: Including "PROACTIVELY" or "MUST BE USED" in descriptions increases automatic invocation.
Spawning Parallel Agents
True parallelism requires separate Claude processes in different worktrees. Within a single REPL, subagents execute sequentially.
# Terminal 1
cd ../project-feature-a && claude
# Terminal 2
cd ../project-feature-b && claude
# Terminal 3
cd ../project-refactor && claude
Quick Setup Script
#!/bin/bash
# spawn-parallel.sh FEATURE_NAME NUM_AGENTS
FEATURE=$1
NUM=${2:-3}
for i in $(seq 1 $NUM); do
git worktree add ".worktrees/${FEATURE}-${i}" -b "${FEATURE}-${i}" main
cp .env ".worktrees/${FEATURE}-${i}/" 2>/dev/null || true
done
echo "Worktrees created. Start Claude in each:"
for i in $(seq 1 $NUM); do
echo " cd .worktrees/${FEATURE}-${i} && claude"
done
Custom Slash Commands
Create .claude/commands/init-parallel.md:
Create $NUM git worktrees for parallel development of $FEATURE.
1. Create .worktrees/ directory if needed
2. For each tree (1 to $NUM):
- Create worktree at `.worktrees/$FEATURE-{i}/`
- Create branch `$FEATURE-{i}`
- Copy environment files
3. Print commands to start Claude in each
Workflow Patterns
Pattern 1: Parallel Feature Implementation
Create 3-4 worktrees for the same feature, give each identical instructions, compare results, merge best implementation.
Pattern 2: Explore, Plan, Code, Commit
- Ask Claude to read relevant files (no writes)
- Use thinking keywords ("think hard", "ultrathink") for extended reasoning
- Have Claude create a plan document
- Implement and commit
Pattern 3: Test-Driven Parallel
- First Claude writes tests, confirms they fail, commits
- Second Claude (or
/clear) implements to pass tests - Third independent review catches overfitting
Pattern 4: Dual Claude Verification
- One Claude writes code
- Afte
Установить parallel-worktrees в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл parallel-worktrees?
Parallel development using git worktrees with Claude Code subagents. Use when spawning multiple async Claude agents across isolated worktrees, running parallel implementations, coordinating multi-agent workflows, leveraging LLM non-determinism for multiple solutions, or running background agents that signal completion. Triggers on "parallel agents", "worktrees", "subagents", "async Claude", "spawn agents", "parallel development", "multi-agent workflow", "background agents", "agent coordination", "parallel tasks".
Как установить скилл parallel-worktrees?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл parallel-worktrees запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic