skills/git-create-worktree/SKILL.md
Create git worktrees. Use this skill specifically for requests that explicitly say to create or add a git worktree — for a PR, an existing branch, or a new local branch. Good trigger phrases: "create a git worktree", "add a git worktree", "create a git worktree for this PR", "create a git worktree for this branch". Leave checkout, branch switching, listing, and removal requests to the normal git workflow.
npx skillsauth add goofansu/pi-stuff git-create-worktreeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Create a git worktree so the user can work on a PR or branch in a separate checkout without disturbing the current one.
Determine what the worktree should check out:
main or develop.Ask for any missing source information before proceeding. For PRs, require a full GitHub PR URL rather than a bare PR number so the repository can be resolved.
For a GitHub PR, run gh pr view <url> --json title,headRefName to get the
head branch, then fetch it:
git fetch origin <headRefName>
For an existing branch, verify it exists locally or on the remote. If it only exists on the remote, fetch it:
git fetch origin <branch>
For a new branch, verify the base branch exists locally or on the remote. If it only exists on the remote, fetch it:
git fetch origin <base-branch>
Worktrees are created as sibling directories of the current project. Use the current repository root to derive the default worktree location:
git rev-parse --show-toplevel.<repo-name>-<sanitized-short-description>.The short description should come from the user request, PR title, branch name, or a brief phrase you ask the user to provide. Sanitize it by lowercasing, replacing spaces, slashes, and punctuation with hyphens, collapsing repeated hyphens, and truncating to a maximum of 30 characters at a word boundary where possible.
Examples:
~/code/my-app; description: new dashboard; path:
~/code/my-app-new-dashboard~/code/my-app; description: fix the broken login on the settings page; path:
~/code/my-app-fix-the-broken-login (truncated to a maximum of 30 characters)Before making changes:
Show the proposed path and branch information to the user and wait for confirmation before proceeding.
Run worktree commands from the main repo root, not from inside another worktree.
For a PR or existing branch:
git worktree add <target-dir> <branch-name>
For a new branch:
git worktree add -b <new-branch> <target-dir> <base-branch>
Report:
cd command to switch to itorigin: run git remote -v to identify the correct
remote name and substitute it in fetch commands.data-ai
Use when the user asks to hand off the current session to a fresh agent.
development
Use when the user asks to research a topic online, find current information, compare options, or produce a research report.
content-media
Use when the user asks to transcribe audio files to text.
testing
Grilling session that challenges your plan against the existing domain model, sharpens terminology, and updates documentation (CONTEXT.md, ADRs) inline as decisions crystallise. Use when user wants to stress-test a plan against their project's language and documented decisions.