Back to Skills

git-worktree-setup

verified

Use PROACTIVELY when working on multiple branches simultaneously or creating parallel Claude Code sessions. Automates git worktree creation with prerequisite checking, development environment initialization, and safe cleanup. Supports single worktree, batch creation, and worktree removal. Not for non-git projects or branch management without worktrees.

View on GitHub

Marketplace

claudex

cskiro/claudex

Plugin

git-worktree-setup

Repository

cskiro/claudex
1stars

plugins/git-worktree-setup/skills/git-worktree-setup/SKILL.md

Last Verified

January 25, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/cskiro/claudex/blob/main/plugins/git-worktree-setup/skills/git-worktree-setup/SKILL.md -a claude-code --skill git-worktree-setup

Installation paths:

Claude
.claude/skills/git-worktree-setup/
Powered by add-skill CLI

Instructions

# Git Worktree Setup

Automates git worktree creation for parallel Claude Code sessions without conflicts.

## When to Use

**Trigger Phrases**:
- "create a worktree for [branch-name]"
- "set up worktree for [feature]"
- "create worktrees for [branch1], [branch2]"
- "remove worktree [name]"
- "list my worktrees"

**Use Cases**:
- Working on multiple features simultaneously
- Parallel Claude Code sessions on different branches
- Code review while continuing development
- Emergency hotfixes without interrupting work

## Quick Decision Matrix

| Request | Mode | Action |
|---------|------|--------|
| "create worktree for X" | Single | Create one worktree |
| "set up worktrees for X, Y" | Batch | Create multiple |
| "remove worktree X" | Cleanup | Remove specific |
| "list worktrees" | List | Display status |

## Workflow Overview

### Phase 0: Prerequisites (Mandatory)
```bash
# Verify git repo
git rev-parse --is-inside-work-tree

# Check uncommitted changes
git status --porcelain

# Get repo name
basename $(git rev-parse --show-toplevel)
```

### Phase 1: Gather Information
- Branch name (required)
- New or existing branch
- Location (default: `../repo-branch`)
- Setup dev environment

### Phase 2: Create Worktree
```bash
# New branch
git worktree add ../project-feature -b feature

# Existing branch
git worktree add ../project-bugfix bugfix
```

### Phase 3: Dev Environment Setup
- Detect package manager
- Run install
- Copy .env files

### Phase 4: Next Steps
- Show worktree path
- Provide navigation commands
- List all worktrees

## Quick Reference Commands

```bash
# Create with new branch
git worktree add ../project-branch -b branch-name

# Create from existing
git worktree add ../project-branch branch-name

# List all
git worktree list

# Remove worktree
git worktree remove ../project-branch

# Remove worktree and branch
git worktree remove ../project-branch
git branch -D branch-name
```

## Package Manager Detection

| Lock File | Manager |
|-----------|--------

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
3294 chars