worktrees

This skill creates git worktrees with tmux sessions and spawns Claude with a prompt.Triggers: "create a worktree", "new worktree", "worktree for branch", "spawn worktree","parallel branch", "work on branch in new session", "worktree-branch script".Creates isolated worktree directories with Claude Code running automatically.Not for regular git branching or checkout operations.

⭐30stars🔀1forks📁View on GitHub🕐Updated Jan 9, 2026⬇️9downloads

When & Why to Use This Skill

This Claude skill automates the creation of isolated Git worktrees within tmux sessions, instantly launching Claude Code with context-specific prompts. It streamlines parallel development by allowing developers to work on multiple branches simultaneously without the overhead of stashing or switching contexts, while leveraging AI to jumpstart tasks immediately.

Use Cases

  • Parallel Bug Fixing: Quickly spin up a separate, isolated environment to address a critical bug on a production branch without interrupting your current feature development.
  • AI-Assisted Feature Implementation: Automatically initialize a new branch and worktree where Claude Code is already briefed on the requirements, allowing the AI to begin coding or refactoring immediately.
  • Code Review and Testing: Create a dedicated worktree for a colleague's Pull Request to run tests and perform reviews in a clean environment while keeping your main workspace intact.
  • Context-Switching Optimization: Use tmux sessions to maintain multiple active development environments, reducing the time spent on branch checkouts and environment re-indexing.
nameworktrees
description|
Triggers"create a worktree", "new worktree", "worktree for branch", "spawn worktree",

Worktrees

Create a git worktree in a new tmux session with Claude Code running a specific prompt.

Command

~/Scripts/worktree-branch --detached --pull --cmd 'cl "$PROMPT"' "$BRANCH"

Parameters

  • $BRANCH - Branch name or remote/branch (e.g., my-feature)
  • $PROMPT - The prompt to pass to Claude Code in the new worktree

Examples

# Create worktree from new branch with Claude prompt
~/Scripts/worktree-branch --detached --pull --cmd 'cl "fix the login bug"' fix-login

# Create worktree from remote branch
~/Scripts/worktree-branch --detached --pull --cmd 'cl "implement the feature from the PR description"' origin/feature-branch

Notes

  • Uses --detached to stay in current tmux session
  • 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 window with the given prompt

$ARGUMENTS