worktrunk
FreeNo executable scriptsNot checkedSets up and drives Worktrunk (the `wt` CLI) so several branches, each in its own git worktree, can be worked on at once by people or AI coding agents. Use…
by TerminalSkills★ 221 GitHub starsAbout this skill
Worktrunk
Overview
A git worktree is a second checkout of one repository in another directory, on another branch.
That is the cheapest isolation available for parallel work: two agents editing two worktrees
cannot overwrite each other's files, yet they share history and can merge locally. Worktrunk's
wt binary wraps the bookkeeping. You name a branch and it derives the directory, runs the
project's setup hooks, optionally starts a program there, reports the state of every checkout in
one table, and lands a finished branch with tests run first and the leftovers removed.
Everything below was run against version 0.80.0 in a throwaway repository. Note that
.worktrunk.toml and keys such as on_create or [create] copy do not exist; the real files
and keys are in step 3 and step 4.
Instructions
1. Check the ground
git --versionis 2.43 or later andwt --versionanswers. On Windows the command may begit-wt, because Windows Terminal owns the namewt.wt config showprints both config paths, pending hook approvals, and whether shell integration is installed. Read it before changing anything.- Ask how finished work should land: a local merge into the default branch, or a pushed branch and a pull request. This decides step 7.
2. Install
Package managers: brew install worktrunk (macOS, Linux), cargo install worktrunk (any Rust
toolchain), winget install max-sixty.worktrunk (Windows). Otherwise take the release archive
and verify it before unpacking:
base=https://github.com/max-sixty/worktrunk/releases/latest/download
curl -fsSLO "$base/worktrunk-x86_64-unknown-linux-musl.tar.xz"
curl -fsSLO "$base/worktrunk-x86_64-unknown-linux-musl.tar.xz.sha256"
sha256sum -c worktrunk-x86_64-unknown-linux-musl.tar.xz.sha256
tar -xJf worktrunk-x86_64-unknown-linux-musl.tar.xz
install -m 0755 worktrunk-x86_64-unknown-linux-musl/wt "$HOME/.local/bin/wt"
Then wt config shell install, once. A child process cannot change its parent's directory, so
this adds a shell function that does the cd. It edits the user's shell startup file: propose
it, do not run it unasked.
3. Decide where worktrees live
The default puts each worktree beside the repository: branch fix/csv-export of
~/code/ledger-api becomes ~/code/ledger-api.fix-csv-export. To change it, set one key in the
user config, ~/.config/worktrunk/config.toml (create it with wt config create):
worktree-path = "{{ repo_path }}/.worktrees/{{ branch | sanitize }}"
The default is {{ repo_path }}/../{{ repo }}.{{ branch | sanitize }}; a central folder would
be ~/worktrees/{{ repo }}/{{ branch | sanitize }}. sanitize turns / into -. With the
in-repo layout, add .worktrees/ to .gitignore; otherwise the main checkout shows it as
untracked.
4. Write the project hooks
Project settings go in .config/wt.toml, committed with the repository
(wt config create --project writes a commented starter). Hook names are fixed:
| Moment | Blocks until done | Runs detached |
|---|---|---|
| Any switch | pre-switch |
post-switch |
| A worktree is created | pre-start |
post-start |
| Worktrunk makes a commit | pre-commit |
post-commit |
wt merge |
pre-merge |
post-merge |
| A worktree is removed | pre-remove |
post-remove |
A failing pre- hook cancels the operation. Use pre-start for anything the program launched
with -x needs at once (dependencies, env files) and post-start for slow or long-lived jobs
(dev server, cache copy). Each hook can be a string, a table of named commands that run
together, or pre-merge blocks that run in sequence.
[pre-start]
deps = "npm ci"
[post-start]
caches = "wt step copy-ignored"
dev = "npm run dev -- --port {{ branch | hash_port }}"
[pre-merge]
test = "npm test"
lint = "npm run lint"
[list]
url = "http://localhost:{{ branch | hash_port }}"
{{ branch | hash_port }}maps a branch name to a stable port between 10000 and 19999, so every worktree gets its own dev server andwt listshows its URL.wt step copy-ignoredcopies gitignored files (node_modules/,.env, build output) from the main worktree into the new one, using copy-on-write on APFS, btrfs and XFS. A.worktreeincludefile with gitignore-style patterns narrows it;--dry-runpreviews it. Python virtual environments hold absolute paths, so recreate them instead of copying.- Other variables:
{{ worktree_path }},{{ primary_worktree_path }},{{ default_branch }},{{ target }}. Values are shell-escaped already: do not quote them.
Project hooks are repository code, so Worktrunk asks before the first run and whenever a command's text changes. Without a terminal the prompt cannot appear and the command fails:
wt hook show # read what would run
wt config approvals add # the user approves; saved in ~/.config/worktrunk/approvals.toml
wt switch
Install worktrunk in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the worktrunk skill do?
Sets up and drives Worktrunk (the `wt` CLI) so several branches, each in its own git worktree, can be worked on at once by people or AI coding agents. Use when a user says "run three agents in parallel on this repo", "give each task its own worktree", "set up worktrunk", "wt switch does not change directory", "add a hook that installs dependencies in new worktrees", "merge this worktree back and clean it up", or asks why a hook wants approval. Covers installation, the switch / list / merge / remove loop, the two config files and their real keys, hooks and their approval step, launching agents with -x, JSON output for scripts, and safe cleanup.
How do I install the worktrunk skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the worktrunk skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
by Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
by Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
by Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
by Anthropic