home / skills / henkisdabro / wookstar-claude-plugins / git-worktrees

This skill enables parallel feature development with git worktrees by preparing isolated workspaces and executing tasks across them.

npx playbooks add skill henkisdabro/wookstar-claude-plugins --skill git-worktrees

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.0 KB
---
name: git-worktrees
description: Parallel development workflow using git worktrees. Prepares isolated worktree directories and executes tasks across multiple workspaces for concurrent feature development. Use when user wants parallel branches, concurrent development, or asks about git worktrees.
---

# Git Worktrees - Parallel Development Workflow

Enable parallel feature development by creating isolated git worktree directories, then executing the same plan across multiple workspaces simultaneously.

## Workflow Overview

### Phase 1: Prepare Worktrees

Create N isolated worktrees for parallel development:

```bash
# Create worktree directory
mkdir -p trees

# Create worktrees (example: 3 parallel workspaces)
git worktree add -b feature-1 ./trees/feature-1
git worktree add -b feature-2 ./trees/feature-2
git worktree add -b feature-3 ./trees/feature-3

# Verify worktrees
git worktree list
```

Each worktree is a complete, isolated copy of the codebase. All worktrees share git history but have independent working directories.

### Phase 2: Execute Tasks in Parallel

Launch N subagents (one per worktree) using the Task tool:

1. Each agent independently implements the plan in their workspace
2. Agents produce RESULTS.md summarising their changes
3. Compare results and cherry-pick the best implementation

**Example Task invocation:**

```
Use the Task tool to launch a general-purpose agent with:
- prompt: "Working in trees/feature-1, implement [plan]. Write a RESULTS.md summarising changes."
- run_in_background: true (for parallel execution)
```

## When to Use

- **Experimental implementations** - Compare different approaches
- **A/B testing code changes** - Try multiple solutions simultaneously
- **Reducing iteration time** - Run multiple attempts in parallel
- **Complex refactoring** - Test different strategies concurrently

## Best Practices

1. **Keep worktree count reasonable** (2-4) to manage cognitive load
2. **Focus on code changes only** - No tests during parallel execution
3. **Clean up worktrees** after selecting the winning implementation:
   ```bash
   git worktree remove ./trees/feature-1
   git worktree prune
   ```
4. **Cherry-pick the winner** to your main branch:
   ```bash
   git cherry-pick feature-2
   # or merge the branch
   git merge feature-2
   ```

## Directory Structure

```
project/
├── trees/
│   ├── feature-1/     # Worktree 1 (full codebase copy)
│   │   └── RESULTS.md
│   ├── feature-2/     # Worktree 2 (full codebase copy)
│   │   └── RESULTS.md
│   └── feature-3/     # Worktree 3 (full codebase copy)
│       └── RESULTS.md
└── (main working directory)
```

## RESULTS.md Template

Each agent should produce a summary in this format:

```markdown
# Results - [Feature Name]

## Changes Made
- List of files modified/created
- Summary of approach taken

## Key Decisions
- Design choices made
- Trade-offs considered

## Testing Notes
- How to verify the implementation
- Known limitations
```

Overview

This skill enables a parallel development workflow using git worktrees to create isolated, concurrent workspaces for feature development. It prepares multiple worktree directories, launches agents or tasks in each workspace, and collects RESULTS.md summaries to compare implementations. Use it to run several approaches at once and pick the best result without blocking your main branch. The skill is opinionated about keeping worktree counts small and focusing on code changes during parallel runs.

How this skill works

The skill automates two phases: prepare and execute. In the prepare phase it creates N worktrees (each a full working copy sharing git history) and verifies them with git worktree list. In the execute phase it launches one subagent per worktree using a Task tool, each agent implements the assigned plan in its workspace and writes a RESULTS.md describing changes. After runs complete, you compare RESULTS.md files, cherry-pick or merge the winning branch, and remove unused worktrees.

When to use it

  • Experimenting with multiple implementations to find the best approach
  • A/B testing alternative code changes or algorithms concurrently
  • Reducing wall-clock iteration time by running attempts in parallel
  • Trying different refactoring strategies on the same codebase
  • When you want isolated working directories without switching branches repeatedly

Best practices

  • Limit concurrent worktrees to 2–4 to keep overhead and cognitive load manageable
  • Focus parallel runs on code changes; run full test suites afterwards in a single workspace
  • Require each agent to produce a RESULTS.md with changes, decisions, and testing notes
  • Clean up leftover worktrees with git worktree remove and git worktree prune
  • Apply the winning changes via cherry-pick or merge, not by copying files between trees

Example use cases

  • Try three algorithm variants in parallel and choose the fastest or simplest
  • Prototype alternative UI implementations in isolated worktrees and compare results
  • Run different refactor strategies concurrently to see which yields fewer conflicts
  • Quickly evaluate multiple bugfix approaches before committing to a single branch
  • Offload repetitive feature attempts to background agents while you continue other work

FAQ

How do I create multiple worktrees?

Use git worktree add -b <branch> ./trees/<name> to create each isolated workspace, then verify with git worktree list.

How are results collected from each worktree?

Each agent writes a RESULTS.md in its worktree summarizing files changed, key decisions, and testing notes for easy comparison.

How should I integrate the winning change?

Cherry-pick the successful branch or merge it into your main branch, then remove unused worktrees and prune stale references.