/worktree

Create isolated git worktrees for parallel feature development without disrupting your main working directory.

Syntax

/worktree [feature-description]                    # Standalone repo
/worktree [project] [feature-description]          # Monorepo

How It Works

  1. Analyzes repo type (standalone/monorepo/superproject)
  2. Detects branch prefix from description
  3. Converts description to kebab-case slug
  4. Creates worktree in smart default location
  5. Auto-installs dependencies based on lock files

Branch Prefixes

Auto-detected from description keywords:

KeywordsPrefix
fix, bug, error, issuefix
refactor, restructure, rewriterefactor
docs, documentation, readmedocs
test, spec, coveragetest
chore, cleanup, depschore
perf, performance, optimizeperf
Defaultfeat

Examples

/worktree add authentication system
# → Creates: worktrees/project-add-auth
# → Branch: kai/feat/add-auth

/worktree fix login validation bug
# → Creates: worktrees/project-login-validation-bug
# → Branch: kai/fix/login-validation-bug

Monorepo

/worktree api add webhook support
# → Creates: worktrees/api-add-webhook-support
# → Branch: kai/feat/add-webhook-support

/worktree frontend refactor dashboard layout
# → Creates: worktrees/frontend-refactor-dashboard
# → Branch: kai/refactor/refactor-dashboard

Worktree Location

Smart defaults based on repo structure:

  1. Superproject: <superproject>/worktrees/
  2. Monorepo: <monorepo>/worktrees/
  3. Standalone: <parent-dir>/worktrees/

Override with --worktree-root <path> if needed.

Dependency Installation

Auto-runs based on lock files:

  • bun.lockbun install
  • pnpm-lock.yamlpnpm install
  • yarn.lockyarn install
  • package-lock.jsonnpm install
  • poetry.lockpoetry install
  • requirements.txtpip install
  • Cargo.tomlcargo build
  • go.modgo mod download

Environment Files

Template files (.env*.example) auto-copied with .example suffix removed.

  • /wt - Monorepo worktree variant