Create a git worktree in a new tmux session with Claude Code running a specific prompt.
Choosing the prompt file
Pick the best option based on what's available:
Issue file — if the work references an issue in thoughts/shared/issues/, use --prompt-file pointing to the issue's plan.md
Other .md file — if the user references a specific markdown file (design doc, spec, etc.), use --prompt-file with that path
Text prompt — otherwise, write the prompt text to a timestamped file in /tmp and pass that path via --prompt-file
Command
# With an issue or markdown file
~/Scripts/worktree-branch --no-switch --pull --binary amp --prompt-file "$FILE" "$BRANCH"
# With a text prompt
PROMPT_FILE="/tmp/worktree-prompt-$(date +%Y%m%d-%H%M%S).md"
cat > "$PROMPT_FILE" <<'EOF'
$PROMPT
EOF
~/Scripts/worktree-branch --no-switch --pull --binary amp --prompt-file "$PROMPT_FILE" "$BRANCH"
Parameters
$BRANCH - Branch name or remote/branch (e.g., my-feature)
$FILE - Path to a .md file to use as the prompt (e.g., thoughts/shared/issues/10-feature/plan.md)
$PROMPT - Text prompt to write to a timestamped /tmp file before passing via --prompt-file
Examples
# From an existing file
~/Scripts/worktree-branch --no-switch --pull --binary amp --prompt-file docs/migration-spec.md migration
# From a text prompt
PROMPT_FILE="/tmp/worktree-prompt-$(date +%Y%m%d-%H%M%S).md"
cat > "$PROMPT_FILE" <<'EOF'
fix the login bug
EOF
~/Scripts/worktree-branch --no-switch --pull --binary amp --prompt-file "$PROMPT_FILE" fix-login
# From a remote branch
PROMPT_FILE="/tmp/worktree-prompt-$(date +%Y%m%d-%H%M%S).md"
cat > "$PROMPT_FILE" <<'EOF'
implement the feature from the PR description
EOF
~/Scripts/worktree-branch --no-switch --pull --binary amp --prompt-file "$PROMPT_FILE" origin/feature-branch
Notes
Uses --no-switch to create the new tmux session without switching to it
Uses --pull to automatically pull main if behind (no prompt)
The new worktree session is created but not switched to
Claude Code starts automatically in the ai1 tmux window with the given prompt
$ARGUMENTS
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: richardgill-nix-worktrees3description: Worktrees4---56# Worktrees78Create a git worktree in a new tmux session with Claude Code running a specific prompt.910## Choosing the prompt file1112Pick the best option based on what's available:13141. **Issue file** — if the work references an issue in `thoughts/shared/issues/`, use `--prompt-file` pointing to the issue's `plan.md`152. **Other .md file** — if the user references a specific markdown file (design doc, spec, etc.), use `--prompt-file` with that path163. **Text prompt** — otherwise, write the prompt text to a timestamped file in `/tmp` and pass that path via `--prompt-file`1718## Command1920```bash21# With an issue or markdown file22~/Scripts/worktree-branch --no-switch --pull --binary amp --prompt-file "$FILE" "$BRANCH"2324# With a text prompt25PROMPT_FILE="/tmp/worktree-prompt-$(date +%Y%m%d-%H%M%S).md"26cat > "$PROMPT_FILE" <<'EOF'27$PROMPT28EOF29~/Scripts/worktree-branch --no-switch --pull --binary amp --prompt-file "$PROMPT_FILE" "$BRANCH"30```3132## Parameters3334- `$BRANCH` - Branch name or remote/branch (e.g., `my-feature`)35- `$FILE` - Path to a .md file to use as the prompt (e.g., `thoughts/shared/issues/10-feature/plan.md`)36- `$PROMPT` - Text prompt to write to a timestamped `/tmp` file before passing via `--prompt-file`3738## Examples3940```bash41# From an existing file 42~/Scripts/worktree-branch --no-switch --pull --binary amp --prompt-file docs/migration-spec.md migration4344# From a text prompt45PROMPT_FILE="/tmp/worktree-prompt-$(date +%Y%m%d-%H%M%S).md"46cat > "$PROMPT_FILE" <<'EOF'47fix the login bug48EOF49~/Scripts/worktree-branch --no-switch --pull --binary amp --prompt-file "$PROMPT_FILE" fix-login5051# From a remote branch52PROMPT_FILE="/tmp/worktree-prompt-$(date +%Y%m%d-%H%M%S).md"53cat > "$PROMPT_FILE" <<'EOF'54implement the feature from the PR description55EOF56~/Scripts/worktree-branch --no-switch --pull --binary amp --prompt-file "$PROMPT_FILE" origin/feature-branch57```5859## Notes6061- Uses `--no-switch` to create the new tmux session without switching to it62- Uses `--pull` to automatically pull main if behind (no prompt)63- The new worktree session is created but not switched to64- Claude Code starts automatically in the `ai1` tmux window with the given prompt6566$ARGUMENTS6768---69> Converted and distributed by [TomeVault](https://tomevault.io/claim/richardgill) — claim your Tome and manage your conversions.70<!-- tomevault:4.0:skill_md:2026-04-11 -->
Run npx skillmds@latest add tomevault-io/richardgill-nix-worktrees in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Worktrees It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
tomevault-io (@tomevault-io) published this skill. Their other Agent Skills are listed on their SkillMD profile.