setup-worktree
Skill4 starsChanged 6 months agoMITView on GitHub
Set up a git worktree for a feature branch in a new web session. Use when user says "setup worktree", "checkout branch", "start feature", or provides a branch name or issue number at the start of a session.
- Commits and pushes
We split this skill into the rules it gives an agent
8 rules. 0 are common, 4 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 30
Search for an existing branch matching the pattern {number}-*:
- Very specific: line 49
Do NOT push automatically.
- Distinctive: line 53
Check if it exists remotely or locally.
- Distinctive: line 62
Before checking out, verify the branch isn't already active in another worktree:
- Very specific: line 68
Look for branch refs/heads/{branch} in the output.
- Distinctive: line 73
Do NOT attempt to resolve this automatically.
- Very specific: line 96
Check if a plan exists at plans/{branch}/plan.md — if so, mention it so the user knows there's prior context
- Distinctive: line 103
Always branch from
main: when creating new branches.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Setup Worktree
Configure the current session to work on a specific feature branch. Designed for web-initiated sessions via claude remote-control --spawn worktree, but works in any context.
Instructions
Step 1: Parse the Input
The argument is passed after the skill invocation (e.g., /setup-worktree 155 or /setup-worktree 155-my-feature).
- Digits only (e.g.,
155) → treat as a GitHub issue number - String with hyphens (e.g.,
155-my-feature) → treat as a full branch name - No argument → ask the user for an issue number or branch name
Step 2: Fetch Latest
git fetch origin --pruneStep 3: Resolve the Branch
If input is a GitHub issue number:
Search for an existing branch matching the pattern
{number}-*:# Check remote git branch -r --list "origin/{number}-*" # Check local git branch --list "{number}-*"- If a matching branch is found → use it (prefer remote if local doesn't exist yet).
- If no matching branch exists → create one:
- Fetch the issue details using the available GitHub tools (owner, repo, issue_number). Extract the
titlefrom the result. - Slugify: lowercase, replace spaces and special characters with hyphens, remove consecutive hyphens, trim trailing hyphens, truncate to reasonable length
- Branch name:
{number}-{slug}(e.g.,155-add-user-dashboard) - Create from main:
git checkout -b {branch} origin/main - Do NOT push automatically. Tell the user: "Branch
{branch}created locally. Push withgit push -u origin {branch}when ready."
- Fetch the issue details using the available GitHub tools (owner, repo, issue_number). Extract the
If input is a full branch name:
- Check if it exists remotely or locally.
- If found → proceed to checkout.
- If not found → show similar branches and stop:
git branch -r --list "origin/*{partial}*" | head -10
Step 4: Check for Worktree Conflicts
Before checking out, verify the branch isn't already active in another worktree:
git worktree list --porcelainLook for branch refs/heads/{branch} in the output.
If the branch is checked out in another worktree → stop and tell the user:
"Branch
{branch}is already checked out in worktree at{path}. What would you like to do?"
Do NOT attempt to resolve this automatically.
Step 5: Check Out the Branch
If the branch exists locally:
git checkout {branch}
git pull --ff-only || echo "Pull skipped (no upstream or diverged)."If the branch only exists on remote:
git checkout -b {branch} origin/{branch}Step 6: Confirm Setup
Report back with:
- Branch name and working directory
- Latest commit:
git log --oneline -1 - Check if a plan exists at
plans/{branch}/plan.md— if so, mention it so the user knows there's prior context
Critical Rules
- Stop on worktree conflicts — never force-checkout or detach other worktrees. Ask the user.
- Never force-checkout over uncommitted changes — if
git statusshows changes, warn the user. - Branch naming convention is
{issue-number}-{slug}— lowercase, hyphen-separated, derived from the issue title. Examples:126-add-import-retry-policy,148-allow-custom-page-size-in-the-datatable. - Always branch from
mainwhen creating new branches. - Do not push automatically — the user decides when to push. Inform them the branch is local-only after creation.
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- temporalio/ui★ 446same name
- Jancera/skills★ 1same name
- mauriciovieira/skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository61 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/ai-workspace-projections.mdcCursor rule
- .cursor/rules/mcp-tool-configs.mdcCursor rule
- .cursor/rules/node-typescript.mdcCursor rule
- .cursor/rules/runstore-listruns-cache.mdcCursor rule
- .cursor/rules/worker-posture.mdcCursor rule
- .cursor/rules/worker-safety.mdcCursor rule
- await-pr-checksSkill
- commitSkill
- create-agentSkill
- create-issueSkill
- create-mcpSkill
- create-planSkill
- create-prSkill
- create-ruleSkill
- create-skillSkill
- create-test-planSkill
- implement-planSkill
- load-contextSkill
- mergeprepSkill
- orchestrate-create-planSkill
- orchestrate-create-test-planSkill
- orchestrate-implement-planSkill
- orchestrate-resolve-pr-commentsSkill
- orchestrate-reviewSkill
- publish-releaseSkill
- resolve-conflictsSkill
- resolve-issue-commentsSkill
- resolve-pr-commentsSkill
- resolve-review-findingsSkill
- review-prSkill
- reviewSkill
- run-test-planSkill
- update-contextSkill
- await-pr-checksSkill
- commitSkill
- create-agentSkill
- create-issueSkill
- create-mcpSkill
- create-planSkill
- create-prSkill
- create-ruleSkill
- create-skillSkill
- create-test-planSkill
- implement-planSkill
- load-contextSkill
- orchestrate-create-planSkill
- orchestrate-create-test-planSkill
- orchestrate-implement-planSkill
- orchestrate-resolve-pr-commentsSkill
- orchestrate-reviewSkill
- publish-releaseSkill
- resolve-conflictsSkill
- resolve-issue-commentsSkill
- resolve-pr-commentsSkill
- review-prSkill
- reviewSkill
- run-test-planSkill
- setup-worktreeSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

