worktree-init
From davila7
Create parallel worktrees for multi-task development with Ghostty panels
Install
/worktree-initFacts
- Repository
- davila7/claude-code-templates
- Status
- Actively maintained
- Last commit
- Declared tools
- Bash(git:*), Bash(mkdir:*), Bash(ls:*), Bash(cat:*), Bash(ba
- Source file
- .claude/commands/worktree-init.md
Source preview
The instructions Claude Code reads when this command runs.
# Worktree Parallel Init
Create multiple git worktrees for parallel development: $ARGUMENTS
## Instructions
You are setting up parallel worktrees so the user can work on multiple tasks simultaneously in separate Ghostty terminal panels, each running its own Claude instance.
### Step 1: Validate Environment
1. Check this is a git repository: `git rev-parse --is-inside-work-tree`
2. Get the repo name: `basename $(git rev-parse --show-toplevel)`
3. Get the main branch name (check for `main` or `master`): `git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@'` — if that fails, default to `main`
4. Ensure working tree is clean: `git status --porcelain`. If dirty, warn the user and ask if they want to continue.
5. Fetch latest: `git fetch origin`
### Step 2: Parse Tasks
Parse tasks from `$ARGUMENTS`. Tasks are separated by `|` (pipe character).
If `$ARGUMENTS` is empty, use AskUserQuestion to ask the user to describe their tasks (they can provide multiple separated by `|`).
For each task description:
- Trim whitespace
- Generate a kebab-case branch name: `claude/<kebab-case-task>` (max 50 chars, alphanumeric and hyphens only)
- Generate a worktree directory path: `../worktrees/<repo-name>/claude-<kebab-case-task>`
### Step 3: Create Worktrees
For each task:
1. Create the parent directory if needed: `mkdir -p ../worktrees/<repo-name>`
2. CView full source on GitHub →Other slash commands
feature-development
★ 229,918Workflow command scaffold for feature-development in everything-claude-code.
affaan-mupdated 14d agoMITdatabase-migration
★ 229,918Workflow command scaffold for database-migration in everything-claude-code.
affaan-mupdated 14d agoMITadd-language-rules
★ 229,918Workflow command scaffold for add-language-rules in everything-claude-code.
affaan-mupdated 14d agoMITcommit-push-pr
★ 137,934Commit, push, and open a PR
anthropicsupdated 13d agodedupe
★ 137,934Find duplicate GitHub issues
anthropicsupdated 13d agotriage-issue
★ 137,934Triage GitHub issues by analyzing and applying labels
anthropicsupdated 13d ago