add-worktree
Skill221 starsChanged 2 months agoMITView on GitHub
Use when the user wants to start work in a new git worktree — "new worktree", "spin up a worktree/branch for this", "work on X in another worktree", "branch this off". Names the branch from the request and creates `<repo parent>/zafiro-worktrees/<branch>` off origin/main.
In this repository10 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- eli5Skill
- grill-meSkill
- grill-with-docsSkill
- handoffSkill
- prompt-engineeringSkill
- release-new-versionSkill
- show-meSkill
- writing-for-agentsSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 64
Run removal only on explicit request.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Add Worktree
Worktrees live in a sibling directory of the primary repo, one directory per branch:
<parent of primary repo>/zafiro-worktrees/<branch name>The directory is the branch name, character for character. A slashed name (fix/latex-render) nests: zafiro-worktrees/fix/latex-render. dev-to-main at /Users/niki/.repo/android/zafiro-worktrees/dev-to-main is a lived example of the layout.
1 — Name the branch from the requirement
<type>/<kebab-case summary>, following the repo's existing branch convention (feat/agent-status, refactor/aidl-state-sync).
| Type | For |
feat | new capability |
fix | bug fix |
refactor | behaviour-preserving restructure |
perf | speed / memory |
chore | build, deps, tooling |
test | tests only |
docs | docs only |
Rules: lowercase ASCII, hyphens only, summary describes the change (fix/latex-blank-render, not fix/niki-work); ≤ 40 characters total, since the name is also the directory name; no ticket numbers, no dates.
The summary comes from what the user asked for. If the user asked for a worktree without saying what the work is, ask before naming — a branch name guessed from nothing is a rename later.
2 — Resolve the paths
REPO=$(dirname "$(git rev-parse --path-format=absolute --git-common-dir)") # primary repo, even from inside a worktree
WT_ROOT="$(dirname "$REPO")/zafiro-worktrees"
BRANCH=fix/latex-blank-render # from step 1
git worktree list # refuse to reuse a path or branch already listedDerive WT_ROOT from the primary repo; do not hardcode an absolute path. Use --git-common-dir, not --show-toplevel: inside a worktree --show-toplevel returns that worktree, which nests zafiro-worktrees/... inside itself.
3 — Create it
Base is origin/main unless the user names another base (dev, a release tag).
git fetch origin
git worktree add -b "$BRANCH" "$WT_ROOT/$BRANCH" origin/main
git -C "$WT_ROOT/$BRANCH" status -sb | head -3To continue an existing branch instead of creating one, drop -b.
Report the absolute worktree path back to the user.
4 — Remove it
git worktree remove "$WT_ROOT/<branch>"
git worktree pruneRun removal only on explicit request; leftover worktrees with uncommitted work are the user's to discard.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

