Back to list
letehaha

worktree

by letehaha

A personal budget tracking application. Track your balances and transactions with bank connections or manual entry, categorize and analyze expenses and income, and many more.

2🍴 1📅 Jan 24, 2026

SKILL.md


name: worktree description: Manage git worktrees for parallel Claude Code sessions. Use when user says "worktree", "create worktree", "parallel session", "new tree", or wants to work on multiple branches simultaneously. allowed-tools: [Bash, Glob, AskUserQuestion]

Git Worktree Manager

Manage git worktrees for running parallel Claude Code sessions.

Commands

/worktree create <branch-name> [from <base-branch>]

Creates a new git worktree for parallel development.

Examples:

  • /worktree create fix-bug - Creates worktree from origin/main
  • /worktree create fix-bug from main - Creates worktree from main branch
  • /worktree create feature-x from develop - Creates from develop

/worktree list

Lists all active worktrees.

/worktree remove [<worktree-name>]

Removes a worktree and its local branch.


Instructions

For create command:

  1. Parse arguments:

    • <branch-name>: Required, the new branch name
    • <base-branch>: Optional, defaults to origin/main
  2. Determine paths:

    REPO_BASENAME=$(basename "$PWD")
    WORKTREE_PATH="../${REPO_BASENAME}--${BRANCH_NAME}"
    ABSOLUTE_PATH=$(cd .. && pwd)/${REPO_BASENAME}--${BRANCH_NAME}
    
  3. Fetch latest:

    git fetch origin
    
  4. Create worktree:

    git worktree add -b <branch-name> <worktree-path> <base-branch>
    
  5. Install dependencies:

    cd <worktree-path> && npm install
    
  6. Return to original directory

  7. Check if running inside tmux:

    if [ -n "$TMUX" ]; then
      # Inside tmux - open new window with claude
      tmux new-window -c "<absolute-path>" -n "<branch-name>" "claude; bash"
    fi
    
  8. CRITICAL - Output this format at the end:

    If tmux was used:

    Worktree created successfully!
    
      Branch: <branch-name>
      Base:   <base-branch>
      Path:   <absolute-path>
    
    New tmux window "<branch-name>" opened with Claude Code.
    Switch to it with: Ctrl+b n (next) or Ctrl+b w (window list)
    

    If NOT in tmux (fallback):

    Worktree created successfully!
    
      Branch: <branch-name>
      Base:   <base-branch>
      Path:   <absolute-path>
    
    To start a parallel Claude Code session, copy and run:
    ┌────────────────────────────────────────────────────────────┐
    │ cd <absolute-path> && claude                               │
    └────────────────────────────────────────────────────────────┘
    

For list command:

Run and display output:

git worktree list

For remove command:

  1. If no worktree name provided, show git worktree list and ask user to specify

  2. Parse worktree name to extract branch:

    • Worktree format: <repo>--<branch>
    • Extract branch: everything after --
  3. Ask for confirmation before proceeding

  4. Remove worktree:

    git worktree remove <worktree-path> --force
    
  5. Delete local branch:

    git branch -D <branch-name>
    
  6. Confirm: "Removed worktree and local branch. Remote branch preserved for PR."


Safety Rules

  • Always git fetch before creating to have latest refs
  • Never remove worktrees with uncommitted changes without explicit confirmation
  • Never remove the main worktree (one without -- in directory name)
  • Preserve remote branches when removing (only delete local branch)
  • If branch already exists, ask user if they want to use existing or create new name

Score

Total Score

75/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon