wt-setup
Skill4 starsChanged 8 months agoMITView on GitHub
Create and maintain `.wt/setup` bootstrap scripts for git worktree environments. The `.wt/setup` script is a repository-local convention executed automatically by supporting tools (e.g. wt) when creating new git worktrees. Use when: (1) a project needs a `.wt/setup` script, (2) setting up worktree-aware bootstrap for a new repo, (3) reviewing or fixing an existing `.wt/setup`, or (4) the user mentions "wt setup", "worktree setup", ".wt/setup", or "bootstrap worktree".
- Installs packages
In this repository25 other files it gives its agents.
- AGENTS.mdAGENTS.md
- greats-soul-archive-contributor/AGENTS.mdAGENTS.md
- agentic-cli-designSkill
- ai-chat-frontendSkill
- autoresearch-agentSkill
- brainstorm-frameworksSkill
- business-planningSkill
- clawdbot-configSkill
- dashboard-design-guidebookSkill
- fermi-estimationSkill
- firecrawlSkill
- gogcliSkill
- greats-soul-archive-contributorSkill
- jp-grantsSkill
- openclaw-agent-creatorSkill
- opencode-agent-creatorSkill
- opencode-command-creatorSkill
- openspec-brownfield-baselineSkill
- oss-publishSkill
- product-improvement-proposalSkill
- python-uv-projectSkill
- rust-cliSkill
- slack-rsSkill
- unit-test-hygieneSkill
- youtube-summarizerSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 2 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Create and maintain .wt/setup scripts -- the standard bootstrap entrypoint executed when a git worktree is created by a supporting tool.
- Distinctive: line 71
Use the generator script or write manually:
- Very specific: line 113
Ensure .wt/setup.local is in .gitignore.
- Distinctive: line 128
Add these entries if not present:
- Very specific: line 138
If the base repo uses pre-commit hooks, .wt/setup SHOULD re-establish them.
- Very specific: line 147
All templates in references/ include this logic.
- Very specific: line 170
After creating .wt/setup, verify:
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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
wt-setup
Create and maintain .wt/setup scripts -- the standard bootstrap entrypoint
executed when a git worktree is created by a supporting tool.
Background
The wt tool (and other tools that follow the
.wt/setup convention) creates git worktrees under
~/.wt/worktrees/<project>-<name>/. When a worktree is created, the tool
looks for .wt/setup in the repository root and executes it inside the new
worktree directory.
Convention
Directory layout
.wt/
AGENTS.md # Documentation for agents about the .wt/ directory
setup # Bootstrap script (executable, committed)
setup.local # Local overrides (gitignored)
worktrees/ # Symlinks to worktrees (gitignored, created by wt)Execution context
| Item | Value |
| Working directory | The new worktree root |
ROOT_WORKTREE_PATH | Path to the base repository (source tree) |
| Interpreter | #!/usr/bin/env bash (portable) |
Design rules
- Idempotent -- safe to run multiple times
- Non-interactive -- no prompts; fail fast on missing prerequisites
- Fast -- avoid slow network operations; cache where possible
- Portable -- use
#!/usr/bin/env bashand standard POSIX tools - Repository-local only -- tools MUST NOT read user-global setup scripts
Creating a .wt/setup
Step 1 -- Detect project type
Inspect the repository to determine what bootstrap actions are needed:
| Indicator | Action |
Makefile with setup target | make setup |
package.json | npm install or pnpm install |
pyproject.toml | uv sync or pip install -e . |
Cargo.toml | cargo fetch |
go.mod | go mod download |
Gemfile | bundle install |
.envrc | direnv allow (if available) |
Step 2 -- Generate the script
Use the generator script or write manually:
# Using the generator
./wt-setup/scripts/generate.py
# Or manually
mkdir -p .wt
cat > .wt/setup << 'SETUP'
#!/usr/bin/env bash
set -euo pipefail
# --- Prerequisites ---
for cmd in make git; do
if ! command -v "$cmd" >/dev/null 2>&1; then
echo "error: $cmd not found" >&2
exit 1
fi
done
# --- Bootstrap ---
make setup
SETUP
chmod +x .wt/setupStep 3 -- Add .wt/setup.local support (optional)
.wt/setup.local is gitignored, so it does not exist in worktrees.
The script must reference the ROOT (source) repository via ROOT_WORKTREE_PATH.
Append to .wt/setup:
# --- Local overrides (from ROOT repo -- .local is gitignored) ---
_local="${ROOT_WORKTREE_PATH:-.}/.wt/setup.local"
if [ -f "$_local" ]; then
# shellcheck source=/dev/null
source "$_local"
fiEnsure .wt/setup.local is in .gitignore.
Step 4 -- Add AGENTS.md (recommended)
Copy the template to .wt/AGENTS.md so AI agents understand the directory:
cp wt-setup/references/AGENTS.md.template .wt/AGENTS.mdOr use the generator with --agents-md flag.
The template is at references/AGENTS.md.template.
Step 5 -- Update .gitignore
Add these entries if not present:
.wt/setup.local
.wt/worktrees/Git hooks in worktrees
Worktrees do NOT inherit git hooks from the base repository.
If the base repo uses pre-commit hooks, .wt/setup SHOULD re-establish them.
The strategy (in priority order):
- pre-commit framework -- if
.pre-commit-config.yamlexists, runpre-commit install - Husky (Node.js) -- if
.husky/exists, runnpx husky install - Fallback -- point
core.hooksPathto the base repo's hooks:git config core.hooksPath "${ROOT_WORKTREE_PATH}/.git/hooks"
All templates in references/ include this logic.
Templates
Template files are in references/. Copy one to .wt/setup and adjust as needed.
| File | Project type |
references/setup-make.sh | Makefile with setup target |
references/setup-node.sh | Node.js (npm / pnpm / yarn) |
references/setup-python.sh | Python (uv) |
references/setup-rust.sh | Rust (cargo) |
references/setup-multi.sh | Multi-language / Makefile-first + local overrides |
Example:
cp wt-setup/references/setup-python.sh .wt/setup
chmod +x .wt/setupValidation checklist
After creating .wt/setup, verify:
- File is executable (
chmod +x .wt/setup) - Shebang is
#!/usr/bin/env bash set -euo pipefailis present- Prerequisite commands are checked before use
- Script is idempotent (safe to re-run)
- No interactive prompts
.wt/setup.localis gitignored.wt/worktrees/is gitignored
Reference
- wt tool: https://github.com/tumf/wt
- Git worktree docs: https://git-scm.com/docs/git-worktree
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.

