# 07 Worktree

> Create and manage git worktrees for isolated feature development. Use when starting a feature that needs branch isolation.

- Skill: `leing2021/07-worktree` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add leing2021/07-worktree`
- Raw SKILL.md: https://api.skillmd.com/api/skills/leing2021/07-worktree/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: leing2021 (https://skillmd.com/u/leing2021)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/leing2021/07-worktree

---


# Worktree

Use this skill for optional isolated git worktree development for large, risky, or parallel feature work.

## Core rules

- Use **`worktree_manager`** tool for all operations
- **Git prerequisite:** `create` requires git — verify with `git rev-parse --is-inside-work-tree`; if it fails, tell the user why and stop
- Only create when user explicitly asks or task is large/risky enough (with confirmation)
- Derive branch name from plan or task
- Report worktree path after creation so `03-work` can execute inside it
- **Never force operations** — if worktree exists, report status instead of duplicating
- On completion: offer merge → cleanup (with user confirmation)

## Workflow

See `references/worktree-lifecycle.md` for detailed flow, branch naming, and error handling.

**Quick reference:**
1. `detect` — check if already in worktree
2. `create` — spin up new worktree with feature branch
3. Execute `03-work` inside worktree directory
4. `merge` — merge feature branch back (with confirmation)
5. `cleanup` — remove worktree and delete branch (with confirmation)

## Branch naming

- `feat/<slug>` — feature work
- `fix/<slug>` — bug fixes
- `chore/<slug>` — maintenance tasks

Before finishing this skill, apply the completion checklist in [shared pipeline instructions](../references/pipeline-config.md).

