Set up Git worktrees for agent parallelization with isolated environments. Use when setting up parallel agent execution, creating isolated environments per agent, or enabling concurrent development workflows.
Creates isolated Git worktrees for parallel agent execution with deterministic port allocation. Use when setting up concurrent development environments or parallel agent workflows.
/plugin marketplace add melodic-software/claude-code-plugins/plugin install google-ecosystem@melodic-softwareThis skill is limited to using the following tools:
Guide creation of isolated Git worktree environments for parallel agent execution.
Git worktrees provide:
repository_root/
├── trees/
│ ├── {adw_id}/ # Isolated worktree
│ │ ├── src/
│ │ ├── .ports.env
│ │ └── ...
│ └── ... # Up to 15 concurrent
├── agents/
│ └── {adw_id}/
│ └── adw_state.json
└── main codebase/
Deterministic formula:
slot = hash(adw_id) % 15
backend_port = 9100 + slot
frontend_port = 9200 + slot
Identify where worktrees should live:
Default: trees/{adw_id}/
Alternative: .worktrees/{adw_id}/
Commands to execute:
# Fetch latest
git fetch origin
# Create worktree with new branch
git worktree add trees/{adw_id} -b {branch_name} origin/main
Create .ports.env:
BACKEND_PORT={backend_port}
FRONTEND_PORT={frontend_port}
VITE_BACKEND_URL=http://localhost:{backend_port}
cp .env trees/{adw_id}/.env
cat trees/{adw_id}/.ports.env >> trees/{adw_id}/.env
For any absolute path configurations (MCP, etc.):
cd trees/{adw_id}
# Backend dependencies
cd app/server && uv sync --all-extras
# Frontend dependencies
cd app/client && bun install
After setup, validate:
git worktree list)git worktree remove trees/{adw_id}
# Or force if uncommitted changes
git worktree remove trees/{adw_id} --force
git worktree prune
git worktree list
Provide setup plan:
## Worktree Setup Plan
**ADW ID:** {adw_id}
**Branch Name:** {branch_name}
**Worktree Path:** trees/{adw_id}
### Port Allocation
- Backend: {backend_port}
- Frontend: {frontend_port}
### Commands to Execute
1. `git fetch origin`
2. `git worktree add trees/{adw_id} -b {branch_name} origin/main`
3. Create `.ports.env`
4. Copy and configure environment
5. Install dependencies
### Validation Steps
- [ ] Verify worktree created
- [ ] Test port availability
- [ ] Confirm dependencies installed
| Issue | Solution |
|---|---|
| Worktree already exists | Remove first or use different ID |
| Port in use | Check what's using it, kill or use different |
| Branch exists | Use existing branch or delete first |
| Permission denied | Check directory permissions |
Date: 2025-12-26 Model: claude-opus-4-5-20251101
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.