agentleFS
maxedappsmaxedapps/agent-skills/skills/use-worktrees/SKILL.md

use-worktrees

Skill59 starsChanged 52 days agoMITView on GitHub

Manages Git worktrees for isolated feature or milestone work. Use this skill whenever work should happen in a worktree, a worktree needs syncing with its target branch, or a finished worktree should be turned into a pull request or cleaned up. Do not use for ordinary single-checkout branch work.

  • Reads credentials

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. Carlososuna11/claude-skills★ 0same 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 repository8 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Run the full check suite after every sync.

    line 41
  2. Distinctive:

    Migrations: if the target took a migration number this branch also uses, renumber this branch's migration, even without a textual conflict.

    line 42
  3. Distinctive:

    Lockfiles: keep both sides' manifest changes and regenerate the lockfile.

    line 43
  4. Very specific:

    Do a final sync, get the checks green, push, and open a pull request.

    line 47
  5. Distinctive:

    If it holds uncommitted or unpushed work, report that work and remove it only with the user's explicit approval.

    line 60

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Use git worktrees

Create

Worktrees live only in ~/worktrees/<repo-dir>/<branch-slug> (branch name with / → -). Create them with Git:

git worktree add ~/worktrees/<repo-dir>/<branch-slug> -b <branch> <target-branch>

For an existing branch, such as an open PR, run git fetch origin <branch>:<branch> and drop -b. Inside herdr (HERDR_ENV=1), don't use herdr worktree create: it opens a separate workspace. Open the worktree in a new pane of your current workspace instead:

herdr pane split --current --direction right --cwd <worktree-path> --no-focus

Tag the new pane as your worker, with its id from the split's reply (result.pane.pane_id), so agentmanager shows it under you:

herdr pane report-metadata <new-pane-id> --source agentmanager --token parent=$HERDR_PANE_ID

Then set it up: install dependencies and copy ignored config such as .env from the main checkout. Give concurrent worktrees their own deployment stage; never let parallel checkouts mutate the same deployment state.

Sync

  • Merge the target branch into the worktree branch (git merge <target-branch>) at checkpoints and before touching anything parallel work may have changed. Never rebase or rewrite shared branches.
  • Run the full check suite after every sync.
  • Migrations: if the target took a migration number this branch also uses, renumber this branch's migration, even without a textual conflict.
  • Lockfiles: keep both sides' manifest changes and regenerate the lockfile; never hand-edit it.

Finish

Do a final sync, get the checks green, push, and open a pull request. Never merge into the target branch yourself; that happens on the PR, when the user asks. No force-push, no bulk --theirs/--ours resolutions.

Cleanup

Whoever created a worktree removes it; an agent working inside one leaves it alone. Once everything is committed, pushed, and in an open PR, remove it right away; later reviews or fixes use a fresh worktree.

git worktree remove <path>
git branch -d <branch>

Close any herdr pane you opened for it.

If it holds uncommitted or unpushed work, report that work and remove it only with the user's explicit approval.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.