| allowed-tools | argument-hint | description |
|---|---|---|
Bash, Read, Task |
<branch-name> |
Create a git worktree and open it in a new Terminal with Claude Code |
- Current repository: !
git rev-parse --show-toplevel 2>/dev/null || echo "Not in a git repository" - Existing worktrees: !
git worktree list 2>/dev/null || echo "Not in a git repository"
Create a git worktree with the name provided in the arguments: $ARGUMENTS
Use the Task tool to execute all the git worktree creation and Terminal operations in a subtask to avoid cluttering the main context.
The subtask should:
- Verify we're in a git repository
- Create a worktree in a sibling directory (../branch-name)
- Use osascript to open a new Terminal tab with this exact AppleScript:
tell application "Terminal" activate tell application "System Events" to tell process "Terminal" to keystroke "t" using command down delay 0.5 do script "cd /path/to/worktree && cc" in selected tab of the front window end tell - The AppleScript MUST use
keystroke "t" using command downto create a tab (NOT a new window) - Use
do scriptwithin selected tab of the front windowto run commands in the new tab
Requirements:
- The worktree name should be: $ARGUMENTS
- Create the worktree as a sibling to the current repository root
- IMPORTANT: Use the exact AppleScript pattern shown above to create a TAB, not a window
- The AppleScript must use
keystroke "t" using command downto open a new tab - Use
do script ... in selected tab of the front windowto run commands in the new tab - Start Claude Code automatically in the new Terminal tab
- Execute all operations in a subtask using the Task tool to keep the main context clean