agentleFS
diegoferigodiegoferigo/dotfiles/.agents/skills/using-worktrunk/SKILL.md

using-worktrunk

Skill4 starsChanged 21 days agoMITView on GitHub

Creates, finds and removes git worktrees with worktrunk (`wt`) instead of `git worktree add`, the built-in worktree tools or ad-hoc directories. Use whenever the task needs a separate checkout or a worktree, for example to work on another branch in parallel, to isolate an experiment, to review a PR or to run a subagent on its own branch, even if the user does not say worktrunk.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 1 is distinctive, and 4 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.

  • 4

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create a worktree only when the task needs one.

    line 10
  2. Very specific:

    Use the usual branch prefix of the repository (for example diegoferigo/<topic>).

    line 21
  3. Very specific:

    Do not pass --no-hooks: the hooks are the point.

    line 22
  4. Very specific:

    Check wt list before creating one and reuse the existing worktree of a branch.

    line 32
  5. Very specific:

    Remove only worktrees you created in this task, and only when the user asked or the work is merged.

    line 40

≈ “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

Using worktrunk for git worktrees

Worktrunk (wt) creates every worktree in <repo>/.worktrees/<branch> and runs the configured setup hooks (for control_suite, the gitignored files a build needs). git worktree add and the built-in worktree commands skip those hooks, so use wt for any new worktree.

Create a worktree only when the task needs one. Do not create one for a change that fits the current checkout.

Create

wt switch --create <branch> --no-cd                  # new branch from the default branch
wt switch --create <branch> --base <base> --no-cd
wt switch pr:<number> --no-cd                        # a pull request branch
  • Pass --no-cd: an agent shell has no wt shell function, so the shell would not follow anyway. The command prints the worktree path; run later commands with cd <path> or git -C <path>.
  • Use the usual branch prefix of the repository (for example diegoferigo/<topic>). Slashes become - in the directory name.
  • Do not pass --no-hooks: the hooks are the point. If a hook fails, report the error instead of working around it.

Find and reuse

wt list                       # worktrees, branches and status
wt list --format json         # same, for parsing
wt switch <branch> --no-cd    # existing worktree, prints its path

Check wt list before creating one and reuse the existing worktree of a branch.

Remove

wt remove <branch> --yes

Remove only worktrees you created in this task, and only when the user asked or the work is merged. Never add --force (removes uncommitted changes) or -D (deletes an unmerged branch): without them wt remove fails safely.

Limits

  • wt is not installed everywhere (command -v wt). If it is missing, tell the user and ask before falling back to git worktree add <repo>/.worktrees/<branch>.
  • A worktree created by Copilot CLI itself (/worktree, /fork worktree, /move, --worktree) lands in the same directory but runs no worktrunk hooks. Prefer wt so the setup runs.

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.