From max-sixty-worktrunk
Guidance for the Worktrunk (wt) CLI, covering git worktree management, hook configuration, and troubleshooting.
How this skill is triggered — by the user, by Claude, or both
Slash command
/max-sixty-worktrunk:worktrunkThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Help users work with Worktrunk, a CLI tool for managing git worktrees.
reference/README.mdreference/claude-code.mdreference/config.mdreference/extending.mdreference/faq.mdreference/hook.mdreference/list.mdreference/llm-commits.mdreference/merge.mdreference/remove.mdreference/shell-integration.mdreference/step.mdreference/switch.mdreference/tips-patterns.mdreference/troubleshooting.mdreference/worktrunk.mdHelp users work with Worktrunk, a CLI tool for managing git worktrees.
Reference files are synced from worktrunk.dev documentation:
{% raw %} deferral, for-each recipes)For command-specific options, run wt <command> --help. For configuration, follow the workflows below.
Worktrunk uses two separate config files with different scopes and behaviors:
~/.config/worktrunk/config.toml)~/.config/worktrunk/config.toml (never checked into git)reference/config.md for detailed guidance.config/wt.toml)<repo>/.config/wt.toml (checked into git)reference/hook.md for detailed guidanceWhen a user asks for configuration help, determine which type based on:
User config indicators:
Project config indicators:
Both configs may be needed: For example, setting up commit message generation requires user config, but automating quality checks requires project config.
Most common request. See reference/llm-commits.md for supported tools and exact command syntax.
Detect available tools
which claude codex llm aichat 2>/dev/null
If none installed, recommend Claude Code (already available in Claude Code sessions)
Propose config change — Get the exact command from reference/llm-commits.md
[commit.generation]
command = "..." # see reference/llm-commits.md for tool-specific commands
Ask: "Should I add this to your config?"
After approval, apply
wt config showwt config createSuggest testing
wt step commit --show-prompt | head # verify prompt builds
wt merge # in a repo with uncommitted changes
Common request for workflow automation. Follow discovery process:
Detect project type
ls package.json Cargo.toml pyproject.toml
Identify available commands
package.json scriptsDesign appropriate hooks (10 hook types: 5 events × pre/post — see reference/hook.md)
pre-startpre-commit or pre-mergepost-startpre-switchpost-switchpost-commitpost-mergepre-removepost-removeValidate commands work
npm run lint # verify exists
which cargo # verify tool exists
Create .config/wt.toml
# Install dependencies when creating worktrees
pre-start = "npm install"
# Validate code quality before committing
[pre-commit]
lint = "npm run lint"
typecheck = "npm run typecheck"
# Run tests before merging
pre-merge = "npm test"
Add comments explaining choices
Suggest testing
wt switch --create test-hooks
See reference/hook.md for complete details.
When users want to add automation to an existing project:
Read existing config: cat .config/wt.toml
Determine hook type - When should this run? (10 types: 5 events × pre/post)
pre-startpost-startpre-switch / post-switchpre-commitpost-commitpre-mergepost-mergepre-remove / post-removeHandle format conversion if needed
Single command to a pipeline of dependent steps:
# Before
pre-start = "npm install"
# After (adding db:migrate, which needs install to finish first)
[[pre-start]]
install = "npm install"
[[pre-start]]
migrate = "npm run db:migrate"
For independent commands, a named table runs them concurrently:
[pre-start]
install = "npm install"
env = "cp .env.example .env"
Preserve existing structure and comments
Before adding hooks, validate:
# Verify command exists
which npm
which cargo
# For npm, verify script exists
npm run lint --dry-run
# For shell commands, check syntax
bash -n -c "if [ true ]; then echo ok; fi"
Dangerous patterns — Warn users before creating hooks with:
rm -rf, DROP TABLEcurl http://...sudoreference/llm-commits.mdreference/config.md#worktree-path-templatereference/llm-commits.md#prompt-templatesreference/config.md#command-configreference/config.md#hooksreference/hook.mdreference/hook.md#hook-formsreference/hook.md#template-variablesreference/config.md#dev-server-urlwt alias → reference/extending.md#aliasesreference/step.md#wt-step-for-eachreference/extending.md#recipe-rebase-every-worktree-onto-its-upstreamwt command → reference/extending.md#deferring-expansion-to-a-nested-wt-command# View all configuration
wt config show
# Create initial user config (LLM/commit setup: see reference/llm-commits.md)
wt config create
# Full config reference (subcommands, templates, env vars)
wt config --help
Load reference files for detailed configuration, hook specifications, and troubleshooting.
Find specific sections with grep:
grep -A 20 "## Setup" reference/llm-commits.md
grep -A 30 "### pre-start" reference/hook.md
grep -A 20 "## Warning Messages" reference/shell-integration.md
Worktrunk never runs a project's hooks or aliases until the user has explicitly approved them. The commands in .config/wt.toml are arbitrary shell code shipped in a repository the user may have just cloned, so on first run Worktrunk shows each command and waits for the user to approve it — an untrusted .config/wt.toml cannot silently execute anything. Approvals are stored per-project in ~/.config/worktrunk/approvals.toml and re-prompted whenever a command template changes, so a hook can't be swapped for a different command after it was approved.
Agents running wt merge, wt switch, or other commands that trigger hooks will hit an error like:
▲ cargo-difftest needs approval to execute 1 command:
○ post-merge install:
cargo install --path .
✗ Cannot prompt for approval in non-interactive environment
↳ To skip prompts in CI/CD, add --yes; to pre-approve commands, run wt config approvals add
The resolution is for the user to make the trust decision themselves:
wt config approvals add — interactive prompt where the user reviews each command before it is stored to ~/.config/worktrunk/approvals.toml. Run once per project; the approval persists across invocations until the command template changes or the project moves. This is the path to recommend — the user reviews and consents to exactly the commands that will run.When invoked as an agent, stop and escalate to the user. Approving a project's hooks is a security decision about whether this repository should be trusted to run arbitrary commands on the user's machine — that decision belongs to the user, not the agent. Tell the user to run wt config approvals add and let them review the commands. Do not run --yes on the user's behalf: it skips the approval gate for that invocation, so reaching for it to unblock a command defeats the protection. --yes exists for CI/CD pipelines that already control their own hook contents; it is not a shortcut for an interactive agent to silence an approval prompt.
When the user requests spawning a worktree with an agent in a background session ("spawn a worktree for...", "hand off to another agent"), use the appropriate pattern for their terminal multiplexer. Substitute <agent-cli> with the CLI you are running as: claude for Claude Code, 'opencode run' for OpenCode.
tmux (check $TMUX env var):
tmux new-session -d -s <branch-name> "wt switch --create <branch-name> -x <agent-cli> -- '<task description>'"
Zellij (check $ZELLIJ env var):
zellij run -- wt switch --create <branch-name> -x <agent-cli> -- '<task description>'
Requirements (all must be true):
CLAUDE.md or AGENTS.md) or an explicit prompt authorize this patternDo not use this pattern for normal worktree operations.
Example (tmux, Claude Code):
tmux new-session -d -s fix-auth-bug "wt switch --create fix-auth-bug -x claude -- \
'The login session expires after 5 minutes. Find the session timeout config and extend it to 24 hours.'"
Example (Zellij, OpenCode):
zellij run -- wt switch --create fix-auth-bug -x 'opencode run' -- \
'The login session expires after 5 minutes. Find the session timeout config and extend it to 24 hours.'
To spawn multiple sub-Agents that each work in their own worktree from one Claude Code session — no terminal multiplexer, no human in the other pane — pre-start each worktree from the parent and pass the path into the sub-Agent prompt:
wt switch --create <branch> --no-cd --no-hooks
Then call the Agent tool without isolation: "worktree", naming the path in the prompt:
You are working in `/abs/path/to/worktrunk.<branch>` on branch `<branch>`.
All edits must stay in that worktree.
--no-cd skips the shell-integration cd script the parent can't consume; --no-hooks is appropriate when each sub-Agent will run its own build/test step (e.g. cargo run -- hook pre-merge --yes) and you don't need post-start setup repeated per worktree.
Do not use Agent { isolation: "worktree" } for this. Claude Code passes its internal agent ID as name to the WorktreeCreate hook, so wt creates the worktree as worktrunk.agent-<id> on a throwaway branch. If the sub-Agent then creates a feature branch on top, you end up with non-canonical paths, orphan branches, and post-start hooks fired against the wrong branch. Pre-creating with wt switch --create keeps path, branch, and hook target aligned.
npx claudepluginhub max-sixty/worktrunkProvides expert guidance on @desplega.ai/wts CLI for managing Git worktrees: create/switch/delete with tmux and Claude Code integration, GitHub PR creation, and cleanup of merged branches.
Manages git worktrees for parallel feature development: create, list, switch between, and merge worktrees with isolated task lists.