Claude
Skills
Sign in
Back

worktree-guide

Included with Lifetime
$97 forever

Interactive guide for parallel development with Ghostty, git worktrees, and Lazygit. Use when setting up multi-task workflows or learning the worktree system.

Productivity

What this skill does


Guide the user through parallel development workflows using Ghostty terminal panels, git worktrees, and Lazygit. This is both a teaching experience and a practical reference.

---

## Preflight

Before starting, detect the user's environment:

```bash
git rev-parse --is-inside-work-tree 2>&1 && echo "GIT_OK" || echo "NOT_GIT"
```

**If not a git repo:**
> This isn't a git repository. Navigate to a git project first, then come back to `/worktree-guide`.

Check if we're in a worktree or main repo:
```bash
git worktree list
pwd
```

Note the context for later guidance.

---

## Phase 1: Welcome & Context Detection

Display based on environment:

**If in main repo:**
```
## Worktree Parallel Development Guide

Welcome! I'll guide you through setting up and using parallel worktrees for multi-task development.

┌─────────────────────────────────────────────────────────────┐
│  Ghostty Terminal                                           │
│  ┌──────────────────────┬──────────────────────┐           │
│  │                      │                      │           │
│  │   Claude (Task 1)    │   Claude (Task 2)    │           │
│  │   claude/login-page   │   claude/fix-auth-bug │           │
│  │                      │                      │           │
│  ├──────────────────────┴──────────────────────┤           │
│  │              Lazygit (monitoring)           │           │
│  └─────────────────────────────────────────────┘           │
└─────────────────────────────────────────────────────────────┘

**Your workflow:**
1. Create worktrees → `/worktree-init`
2. Open Ghostty panels → `Cmd+D` / `Cmd+Shift+D`
3. Run Claude in each panel → `cd <worktree> && claude`
4. Deliver when done → `/worktree-deliver`
5. Clean up → `/worktree-cleanup`

What would you like to do?
```

Use AskUserQuestion:
- "Learn the full workflow" — Start from Phase 2
- "Just show keybindings" — Jump to Quick Reference
- "Create worktrees now" — Suggest `/worktree-init`
- "Something else" — Ask what they need

**If already in a worktree:**
```
## Worktree Status

You're already inside a worktree! Let me check your status.
```

Then run the equivalent of `/worktree-check` and provide contextual guidance.

---

## Phase 2: Ghostty Essentials

**EXPLAIN:**
```
## Ghostty Panel Management

Ghostty's panel system is perfect for parallel development. Here are the essential keybindings:
```

**SHOW:**
```
┌─────────────────────────────────────────────────────────────┐
│                    GHOSTTY KEYBINDINGS                      │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  SPLITTING                                                  │
│  ─────────                                                  │
│  Cmd+D           Split panel to the right                   │
│  Cmd+Shift+D     Split panel below                          │
│                                                             │
│  NAVIGATION                                                 │
│  ─────────                                                  │
│  Cmd+Alt+←/→/↑/↓ Move focus between panels                  │
│  Cmd+[/]         Cycle through panels                       │
│                                                             │
│  SIZING                                                     │
│  ─────────                                                  │
│  Cmd+Shift+E     Equalize all panel sizes                   │
│  Cmd+Shift+F     Toggle zoom (fullscreen current panel)     │
│                                                             │
│  CLOSING                                                    │
│  ─────────                                                  │
│  Cmd+W           Close current panel                        │
│                                                             │
└─────────────────────────────────────────────────────────────┘

**Pro tip:** Use Cmd+Shift+F to zoom into a panel when you need focus, then press it again to return to the multi-panel view.
```

**PAUSE** - "Ready to learn about Lazygit? (Or skip to workflow)"

---

## Phase 3: Lazygit Essentials

**EXPLAIN:**
```
## Lazygit for Monitoring Worktrees

Lazygit gives you a visual overview of all your worktrees and their changes. Run it from your main repo to monitor everything.
```

**SHOW:**
```
┌─────────────────────────────────────────────────────────────┐
│                    LAZYGIT KEYBINDINGS                      │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  WORKTREES (navigate to Worktrees panel)                    │
│  ─────────                                                  │
│  w              Switch to worktree panel (or create new)    │
│  Enter          Switch to selected worktree                 │
│  n              Create new worktree                         │
│  d              Delete worktree (with confirmation)         │
│                                                             │
│  FILES & STAGING                                            │
│  ─────────                                                  │
│  Space          Stage/unstage file                          │
│  a              Stage all files                             │
│  Enter          View file diff (with Delta highlighting)    │
│                                                             │
│  COMMITS                                                    │
│  ─────────                                                  │
│  c              Commit staged changes                       │
│  C              Commit with editor                          │
│  A              Amend last commit                           │
│                                                             │
│  SYNC                                                       │
│  ─────────                                                  │
│  P              Push                                        │
│  p              Pull                                        │
│  f              Fetch                                       │
│                                                             │
│  GENERAL                                                    │
│  ─────────                                                  │
│  ?              Help (context-sensitive)                    │
│  q              Quit / go back                              │
│  Tab            Switch panels                               │
│                                                             │
└─────────────────────────────────────────────────────────────┘

**Monitoring workflow:**
1. Open lazygit in the main repo (or a dedicated Ghostty panel)
2. Press `w` to see all worktrees
3. Use Enter to dive into any worktree's changes
4. Press `q` to go back to the worktree list
```

**PAUSE** - "Ready for the full workflow walkthrough?"

---

## Phase 4: Complete Workflow (Guided)

**EXPLAIN:**
```
## Full Parallel Development Workflow

Let me walk you through the complete cycle. We'll go step by step.
```

### Step 4.1: Create Worktrees

**EXPLAIN:**
```
### Step 1: Create Worktrees

First, define the tasks you want to work on in parallel. The `/worktree-init` command creates a worktree for each task.
```

**DO:** Show example command:
```
Example usage:

/worktree-init add user authentication | fix login bug | improve dashboard performance

This creates:
├── ../worktrees/<repo>/claude-add-user-authentication/
├── ../worktrees/<repo>/claude-fix-login-bug/
└── ../worktrees/<repo>/claude-improve-dashboard-performance/
```

### Step 4.2: Open Ghostty Panels

**EXPLAIN:**
```
### Step 2: Open Ghostty Panels

Now split your terminal into panels—one for each task, plus optionally one for Lazygit monitoring.
```

**DO:**
```
1. Press Cmd+D to split right (first worktree)
2. Press Cmd+D again (second worktree)
3. Optionally press Cmd+Shift+D on any panel for Lazygit be

Related in Productivity