with one click
worktree-start
// Set up a git worktree for a parallel-session task and copy required gitignored state
// Set up a git worktree for a parallel-session task and copy required gitignored state
| name | worktree-start |
| description | Set up a git worktree for a parallel-session task and copy required gitignored state |
Set up a new linked worktree and initialize its gitignored state before starting work.
Personal config: Set WORKTREE_BASE_DIR in your agents config to customize the worktree
base path. Default: ~/git/worktrees. Windows example: WORKTREE_BASE_DIR=C:\git\worktrees.
Verify the task fits the worktree criteria in rules/worktree.md (fit table).
If it does not fit, report why and stop — set ENFORCE_WORKTREE=off in agents config
and work on main directly instead.
Estimate the task name from the user's message. Task names must match [a-zA-Z0-9_-]+
(no slashes, dots, spaces, or shell metacharacters).
Estimate the branch type: feature / fix / refactor / docs / chore.
Ask the user to confirm both (or suggest corrections) with AskUserQuestion.
Compute the canonical worktree path and show it to the user for final confirmation:
<WORKTREE_BASE_DIR>/<task-name>/<repo-name>
Branch name: <type>/<task-name>
Check for conflicts:
git worktree list --porcelain
Report any existing worktrees at the same path or on the same branch.
Create the parent directory (platform-aware):
mkdir -p "<WORKTREE_BASE_DIR>/<task-name>"New-Item -ItemType Directory -Force -Path "<WORKTREE_BASE_DIR>\<task-name>"Create the worktree:
git worktree add <path> -b <type>/<task-name>
Enumerate gitignored and untracked files in main (NUL-delimited for paths with spaces and non-ASCII characters):
git -C <main> ls-files --others --ignored --exclude-standard -z
git -C <main> ls-files --others --exclude-standard -z
Classify the results and present to the user:
.env.local, .env.development, dev credentials, development configs.env.production, cloud credentials, deploy keys, prod tokens,
customer data access keys.env.example
as a base. Present the generation command (e.g., /create-key) —
the user must create and fill in the actual .env file. Claude must not write to .env
directly.Copy files per user instruction (candidates are presented automatically; user approval required).
Create WORKTREE_NOTES.md in the worktree root recording:
WORKTREE_BASE_DIR value used# Worktree Notes
Branch: <type>/<task-name>
Created: <date>
Path: <resolved-path>
WORKTREE_BASE_DIR: <value or "(default)">
## Gitignored files copied from main
- <file1>
- <file2>
Add WORKTREE_NOTES.md to .git/info/exclude if not already covered by .gitignore.
Final report: worktree path, branch, and which gitignored state was copied.
.env files directly..env.production, cloud credentials, deploy keys) to a worktree.WORKTREE_NOTES.md so /worktree-end can inventory it later.[a-zA-Z0-9_-]+ — do not proceed with invalid names.[HINT] Download the complete skill directory including SKILL.md and all related files