/git:creating-worktreefrom git
Creates isolated git worktrees in .claude/worktrees/ with intelligent branch naming, auto-incrementing, and commit type detection. Supports manual descriptions, auto-generation from uncommitted changes, or linkage to SDLC specs.
Ships in git. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Create isolated git worktrees in .claude/worktrees/ with intelligent branch naming. Combines worktree isolation with the same naming convention as the creating-branch skill.
This skill is invoked when:
/worktree or /git:worktree commandThe command takes a description and automatically detects the commit type.
Format: /worktree <description>
Examples:
/worktree add user authentication
# Worktree: .claude/worktrees/user-authentication
# Branch: feat/001-user-authentication
/worktree fix login bug
# Worktree: .claude/worktrees/login-bug
# Branch: fix/002-login-bug
/worktree refactor auth service
# Worktree: .claude/worktrees/auth-service
# Branch: refactor/003-auth-service
When no arguments provided and no sdlc-develop specs exist, analyze uncommitted changes to generate names automatically.
Format: /worktree (no arguments)
Process:
When no arguments provided and sdlc-develop specs exist, create worktree linked to an existing feature spec.
Detection Flow:
.arkhe.yaml exists -> read develop.specs_dir (default: arkhe/specs){specs_dir}/ for existing spec directoriesAskUserQuestionThis skill produces dual names:
| Component | Format | Example |
|---|---|---|
| Worktree directory | .claude/worktrees/{keywords} | .claude/worktrees/user-authentication |
| Git branch | {type}/{number}-{keywords} | feat/001-user-authentication |
The directory uses just keywords (tab-completion friendly). The branch uses the full conventional format (consistent with /create-branch).
Automatically detect commit types from keywords in the description:
| Type | Keywords |
|---|---|
| feat | add, create, implement, new, update, improve |
| fix | fix, bug, resolve, correct, repair |
| refactor | refactor, rename, reorganize |
| chore | remove, delete, clean, cleanup |
| docs | docs, document, documentation |
If no keyword is detected, defaults to feat.
# Check for arguments
DESCRIPTION="$ARGUMENTS"
If $ARGUMENTS is provided -> Mode 1 (manual)
If empty -> check for .arkhe.yaml specs (Mode 3), then fall back to auto-generate (Mode 2)
For Mode 2 (auto-generate):
# Check for uncommitted changes
CHANGED_FILES=$(git diff --name-only HEAD 2>/dev/null; git diff --cached --name-only 2>/dev/null)
If no changes, display error: "No arguments and no uncommitted changes. Provide a description: /worktree <description>"
If changes exist, analyze filenames/paths to generate a description.
Detect commit type from description keywords (see table above). Default to feat.
Extract keywords: Filter stopwords from description, keep first 2-3 meaningful words, hyphenate.
Find next sequential number:
# Scan ALL branches (shared number space with /create-branch)
MAX_NUM=$(git branch --list | grep -oE '/[0-9]{3}-' | grep -oE '[0-9]{3}' | sort -n | tail -1)
NEXT_NUM=$(printf "%03d" $((10#${MAX_NUM:-0} + 1)))
Assemble names:
KEYWORDS (e.g., user-authentication)TYPE/NUMBER-KEYWORDS (e.g., feat/001-user-authentication)# Check directory doesn't already exist
ls .claude/worktrees/$KEYWORDS 2>/dev/null
If it exists, report the conflict and stop. Suggest either a different description or removing the existing worktree.
Also check if the branch already exists:
git branch --list "$TYPE/$NEXT_NUM-$KEYWORDS"
If the branch exists, increment the number and retry.
Verify .claude/worktrees/ is git-ignored:
git check-ignore -q .claude/worktrees 2>/dev/null
If NOT ignored (exit code non-zero), add .claude/worktrees/ to .gitignore:
echo '\n# Worktrees\n.claude/worktrees/' >> .gitignore
git add .gitignore && git commit -m "chore: add .claude/worktrees/ to .gitignore"
Use AskUserQuestion to ask which branch to base the worktree on:
mkdir -p .claude/worktrees
git worktree add ".claude/worktrees/$KEYWORDS" -b "$TYPE/$NEXT_NUM-$KEYWORDS" "$BASE_BRANCH"
Where $BASE_BRANCH is main, HEAD, or the user-specified branch.
Report:
.claude/worktrees/<keywords><type>/<number>-<keywords> (based on <base-branch>)git worktree listgit worktree remove .claude/worktrees/<keywords>/create-branch -- scans all branchesWhat SKILL.md sets; muted values are Claude Code's defaults
haikuThree short reads, in order
11 skills in this plugin
/cleaning-up-branchesDeletes merged git branches (local and remote) and flags stale unmerged branches for manual review. Use when user mentions "cleanup branches", "delete merged branches", "prune old branches", "remove stale branches", "branch cleanup", or runs /cleanup-branches command./creating-branchCreates feature branches with optimized short naming, auto-incrementing, and commit type detection (feat/fix/refactor). Supports manual descriptions and auto-generation from uncommitted git changes. Use when user requests to create branch, start new branch, make branch, checkout new branch, switch branch, new task, start working on, begin work on feature, begin feature, create feature branch, run /create-branch command, or mentions "branch", "feature", "new feature", "feat", "fix", or "checkout"./npx claudepluginhub joaquimscosta/arkhe-claude-plugins --plugin gitOther plugins' skills for the same job