speckit-git-worktree
Create a new git worktree under the project's ${PROJ}.worktrees collector directory
SKILL.md.specify/extensions/git/.specify-dev/agent-commands/claude/speckit-git-worktree/SKILL.md
GitHubCreate Worktree
Create a new Git worktree for an existing or new branch. By default, the command derives the collector directory from the primary checkout and places the worktree at:
<parent-of-primary-checkout>/<project>.worktrees/<branch>
This matches the same convention used by the feature workflow.
User Input
$ARGUMENTS
You MUST consider the user input before proceeding (if not empty).
Behavior
- Require a branch argument (
<branch>). - Optionally accept a start-point (
<start-point>) to create a new branch from. - Derive the target path using the shared collector convention unless overridden.
- Create the collector directory when missing.
- Create the worktree with
git worktree add. - After successful creation, ask the user whether to move into the new worktree directory using the
AskUserQuestiontool. - Print a short status summary including branch and path.
Post-Creation Prompt
After parsing command output and obtaining WORKTREE_PATH, call the AskUserQuestion tool with a yes/no choice:
question:Worktree created at <WORKTREE_PATH>. Move into this directory now?options[]:{label: "Yes", description: "I will move into the new worktree now"}{label: "No", description: "Stay in the current directory"}
multiSelect:false
If the user selects Yes, output and execute the command:
cd <WORKTREE_PATH>
If the user selects No, continue without changing directories.
Arguments
--path <absolute-path>: Explicit worktree path override (same behavior asSPECKIT_WORKTREE_PATH).--parent <absolute-path>: Explicit collector directory override (same behavior asSPECKIT_WORKTREE_PARENT).<branch>: Required branch name.<start-point>: Optional revision/branch/tag used when creating a new branch.
Execution
- Bash:
.specify/extensions/git/scripts/bash/worktree-add.sh [--path <absolute-path>] [--parent <absolute-path>] <branch> [<start-point>]
Graceful Degradation
- If Git is not available or the current directory is not a repository: warn and exit.
- If the target path already exists: refuse and explain how to override with
--path. - If branch creation/worktree add fails: print Git error output and exit non-zero.