with one click
git-worktree-create
Create a git worktree and enter it for immediate work
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Create a git worktree and enter it for immediate work
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Backlog-scale orchestration on top of /workflow — drives PM items through refine → plan → implement → review → local-merge via role-specialized sub-agents dispatched in parallel waves, each item isolated in its own git worktree. Bare /swarm summarizes state; /swarm <goal> runs the orchestrator; /swarm:setup sets up the charter and .agent-tools/ umbrella; /swarm:continue resumes a paused run.
Capture durable knowledge from any engineering work — debugging solutions, refactors, features, design decisions, reusable patterns — and maintain memory quality so each unit of work compounds the next
Principal workflow entry — resolve portfolio mode (swarm resume/handoff or unit state machine), drive work without inventing path; hard-stop when path is not established
Initialize and maintain planning root (.agent-tools/planning preferred), conventions (tracks, gates, integration), runs ledger scaffold, and shared memory under .agent-tools/memory/ (AGENTS.md memory-link) for the workflow family.
Parent skill for the workflow family — principal session entry is /workflow:continue (also bare /workflow). Horizon mapping, brainstorm, refine, plan, execute, review, audit, compound. Vertical-slice and deliverable-partition modes.
Detect gaps in the canonical skill corpus, propose targeted improvements, validate changes, and present for review. Inventories src/** skill trees; optional run-ledger seeds for process IP gaps.
| name | git:worktree-create |
| user-invocable | true |
| allowed-tools | Bash(git worktree:*), Bash(git branch:*), Bash(git rev-parse:*), Bash(git log:*), Bash(git status:*), Bash(ls:*), Bash(pwd:*), Bash(cd:*), Bash(cp:*), Bash(pnpm:*), Bash(npm:*), Bash(bun:*), Bash(yarn:*), Bash(uv:*), Bash(poetry:*), Bash(pipenv:*), Bash(pip:*) |
| description | Create a git worktree and enter it for immediate work |
| argument-hint | [name] [from <ref>] [--type feat|fix|chore] [--branch <name>] |
NEVER use git -C <path> in any git command. The session is already active in the correct working directory. Always use plain git commands (e.g., git status, git worktree add). This rule is absolute and has no exceptions. Violating this rule will produce incorrect results.
$ARGUMENTS
Parse the following from $ARGUMENTS (all optional):
| Argument | Syntax | Default |
|---|---|---|
| Name | Bare word or phrase (no prefix) | Generate a random <adjective>-<noun> pair (e.g., swift-falcon, bright-otter) |
| Base ref | from <ref> | main |
| Branch type | --type <type> | feat |
| Branch name override | --branch <full-name> | Auto-generated as <type>/<name> |
If any argument is ambiguous or unclear, stop and ask the user before proceeding.
git rev-parse --show-toplevel
Store this as REPO_ROOT.
Run these checks in order. Stop with a clear error if any fail:
Not inside a worktree — Compare git rev-parse --show-toplevel with git rev-parse --git-common-dir. If --git-common-dir is NOT .git (i.e., it points to another repo's .git directory), you are inside a worktree. Error: "You are already inside a worktree. Navigate to the main repo root first."
Current branch check — Run git branch --show-current. If the current branch is NOT main and no explicit from <ref> was provided by the user, inform the user they are not on main and confirm they want the worktree created from main (the default). If ambiguous, stop and ask.
Base ref exists — Verify the base ref resolves:
git rev-parse --verify <base-ref>
If it fails, error: "Base ref '' does not exist."
No name collision — Check that the target worktree path does not already exist.
Check that <REPO_ROOT>/.claude/worktrees/<name>/ does not already exist. If it does, error: "A worktree named '' already exists."
Check that <REPO_ROOT>/.grok/worktrees/<name>/ does not already exist. If it does, error: "A worktree named '' already exists."
Check that <REPO_ROOT>/.factory/worktrees/<name>/ does not already exist. If it does, error: "A worktree named '' already exists."
Check that <REPO_ROOT>/.codex/worktrees/<name>/ does not already exist. If it does, error: "A worktree named '' already exists."
git branch --list <type>/<name>
If the branch already exists, error: "Branch '/' already exists."git worktree add -b <type>/<name> <TARGET_WORKTREE_PATH> <base-ref>
Use <REPO_ROOT>/.claude/worktrees/<name> as the target path.
Use <REPO_ROOT>/.grok/worktrees/<name> as the target path.
Use <REPO_ROOT>/.factory/worktrees/<name> as the target path.
Use <REPO_ROOT>/.codex/worktrees/<name> as the target path.
If --branch was provided, use that as the full branch name instead of <type>/<name>.
Switch the session's working directory into the new worktree:
cd <TARGET_WORKTREE_PATH>
Use <REPO_ROOT>/.claude/worktrees/<name> as the path.
Use <REPO_ROOT>/.grok/worktrees/<name> as the path.
Use <REPO_ROOT>/.factory/worktrees/<name> as the path.
Use <REPO_ROOT>/.codex/worktrees/<name> as the path.
This is the same pattern used by @workflow (execution) for entering existing worktrees. It switches the Bash working directory for subsequent commands without disrupting other sessions.
Do not use any agent-specific "enter worktree" tool that auto-creates from HEAD — always use explicit git worktree commands so you can control the base ref and target directory (see the agent blocks above for the correct path pattern).
Restore project dependencies so the worktree is ready to work immediately. Follow the procedure in @workflow (dependency establishment):
$REPO_ROOT (Node.js only, non-pnpm — uses COW clones where available)REPO_ROOT was already captured in Phase 1.1. Dependency establishment must never block worktree entry — warn on failure and continue.
Confirm the following to the user:
<name><type>/<name> (or the --branch override)<base-ref>