Back to Skills

worktree

verified

Git worktree automation for isolated feature development. Triggers on: '/worktree create', '/worktree list', '/worktree remove'. Creates isolated working directories with automatic setup.

View on GitHub

Marketplace

oh-my-claude

TechDufus/oh-my-claude

Plugin

oh-my-claude

productivity

Repository

TechDufus/oh-my-claude
48stars

plugins/oh-my-claude/skills/worktree/SKILL.md

Last Verified

January 24, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/TechDufus/oh-my-claude/blob/main/plugins/oh-my-claude/skills/worktree/SKILL.md -a claude-code --skill worktree

Installation paths:

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

Instructions

# Worktree Skill

Git worktree automation for isolated feature development.

## When This Skill Activates

| Category | Trigger Phrases |
|----------|-----------------|
| **Create worktree** | `/worktree create <name>`, `/worktree new <name>` |
| **List worktrees** | `/worktree list`, `/worktree ls` |
| **Remove worktree** | `/worktree remove <name>`, `/worktree rm <name>` |
| **Status** | `/worktree status` |

## Commands

### Create Worktree

```
/worktree create <feature-name>
```

Creates an isolated worktree for feature development.

**Workflow:**
1. Generate branch name: `feat/<feature-name>`
2. Create worktree: `git worktree add .worktrees/<feature-name> -b feat/<feature-name>`
3. Copy environment files (if they exist):
   - `.env`, `.env.local`, `.env.development`
   - `.nvmrc`, `.node-version`
   - `.npmrc`
4. Detect and run package manager install:
   - If `package-lock.json` → `npm install`
   - If `yarn.lock` → `yarn install`
   - If `pnpm-lock.yaml` → `pnpm install`
   - If `bun.lockb` → `bun install`
5. Add `.worktrees/` to `.gitignore` if not present
6. **Verify worktree creation:**
   - Run `git -C .worktrees/<name> status` to confirm clean state
   - Run `git worktree list` to confirm worktree is registered
   - If verification fails, run cleanup and report error
7. Report path and instructions

**Example:**
```bash
git worktree add .worktrees/auth-feature -b feat/auth-feature
cp .env .worktrees/auth-feature/ 2>/dev/null || true
cp .nvmrc .worktrees/auth-feature/ 2>/dev/null || true
cd .worktrees/auth-feature && npm install
```

### List Worktrees

```
/worktree list
```

Shows all active worktrees:
```bash
git worktree list
```

### Remove Worktree

```
/worktree remove <name>
```

Removes a worktree and optionally its branch:

**Workflow:**
1. Confirm removal with user
2. Remove worktree: `git worktree remove .worktrees/<name> --force`
3. Ask if branch should be deleted
4. If yes: `git branch -D feat/<name>`

### Status

```
/worktree status
```

Validation Details

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