本文へ移動
cccskills
無料GitHub で公開

creating-worktree

Creates isolated git worktrees in .claude/worktrees/ with intelligent branch 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 worktree, start isolated work, parallel development, run /worktree command, or mentions "worktree".

インストール方法を見る

含まれるファイル(4)

  • SKILL.md6.8 KB
  • EXAMPLES.md6.3 KB
  • TROUBLESHOOTING.md6.1 KB
  • WORKFLOW.md10.4 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Git Worktree Creation Workflow

Create isolated git worktrees in .claude/worktrees/ with intelligent branch naming. Combines worktree isolation with the same naming convention as the creating-branch skill.

Usage

This skill is invoked when:

  • User runs /worktree or /git:worktree command
  • User requests to create a worktree for isolated work

Two Operation Modes

Mode 1: With Description (Manual)

The 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

Mode 2: Auto-Generate from Changes (No Arguments)

When no arguments provided and no sdlc-develop specs exist, analyze uncommitted changes to generate names automatically.

Format: /worktree (no arguments)

Process:

  1. Check for sdlc-develop specs (see Mode 3)
  2. If no specs, check for uncommitted changes (both staged and unstaged)
  3. If no changes exist, display error and require description
  4. If changes exist, analyze to generate description
  5. Create worktree with auto-generated names

Mode 3: From SDLC-Develop Spec (Arkhe Integration)

When no arguments provided and sdlc-develop specs exist, create worktree linked to an existing feature spec.

Detection Flow:

  1. Check if .arkhe.yaml exists -> read develop.specs_dir (default: arkhe/specs)
  2. Scan {specs_dir}/ for existing spec directories
  3. If specs found -> present selection via AskUserQuestion
  4. Use spec directory name for worktree and branch names

Naming Convention

This skill produces dual names:

ComponentFormatExample
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).

Commit Type Detection

Automatically detect commit types from keywords in the description:

TypeKeywords
featadd, create, implement, new, update, improve
fixfix, bug, resolve, correct, repair
refactorrefactor, rename, reorganize
choreremove, delete, clean, cleanup
docsdocs, document, documentation

If no keyword is detected, defaults to feat.

Keyword Extraction

  1. Split description into words
  2. Remove stopwords: the, a, an, for, to, in, on, at, by, with, from, and, or, but, this, that
  3. Remove commit type keywords (add, fix, create, etc.)
  4. Keep first 2-3 meaningful words
  5. Convert to lowercase, join with hyphens

Workflow Steps

Step 1: Parse Arguments and Determine Mode

# 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.

Step 2: Generate Names

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:

  • Worktree directory: KEYWORDS (e.g., user-authentication)
  • Git branch: TYPE/NUMBER-KEYWORDS (e.g., feat/001-user-authentication)

Step 3: Validate Worktree Directory

# 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.

Step 4: Safety Check - Git Ignore

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"

Step 5: Ask Base Branch

Use AskUserQuestion to ask which branch to base the worktree on:

  • main (Recommended) -- Create from the main branch
  • Current branch -- Create from the currently checked out branch
  • Other -- User specifies a different branch name

Step 6: Create Worktree

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.

Step 7: Confirm Success

Report:

  • Worktree path: .claude/worktrees/<keywords>
  • Git branch: <type>/<number>-<keywords> (based on <base-branch>)
  • List worktrees: git worktree list
  • Remove when done: git worktree remove .claude/worktrees/<keywords>

Important Notes

  • Sequential Numbering: Shared number space with /create-branch -- scans all branches
  • Keyword Extraction: Filters common words, keeps 2-3 meaningful terms
  • Lowercase Convention: All names are lowercase with hyphens
  • Conventional Commits: Branch names align with conventional commit types
  • Dual Naming: Directory name differs from branch name for usability

Supporting Documentation

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

adr

無料

Create, review, and manage Architecture Decision Records (ADRs) with auto-numbering, template detection, quality review, and index maintenance. Use when user mentions "ADR", "architecture decision", "document this decision", "create ADR", "review ADR", editing ADR files (docs/adr/, doc/adr/, .adr/), or discussing architectural choices and tradeoffs.

日本語の概要は準備中です。原文の説明を表示しています。

joaquimscosta/arkhe-claude-plugins212026年8月14日 更新

architect

無料

Analyze system architecture, module structure, API contracts, data models, and code patterns. Use when designing systems, reviewing module boundaries, evaluating API designs, analyzing data models, checking pattern conformance, tracing decisions, or reviewing frontend architecture. Triggers: "architecture", "module design", "API design", "data model", "boundaries", "patterns", "decisions", "frontend architecture".

日本語の概要は準備中です。原文の説明を表示しています。

joaquimscosta/arkhe-claude-plugins212026年8月14日 更新

Converts natural-language descriptions or UI spec files into optimized Google Stitch prompts. Use when creating, refining, or validating design directives for Google Stitch. Use when user says "create a Stitch prompt", "optimize this for Stitch", "convert this spec to a Stitch prompt", "write a UI prompt", or mentions Google Stitch prompt authoring. Follows Stitch best practices with short, directive prompts focused on screens, structure, and visual hierarchy.

日本語の概要は準備中です。原文の説明を表示しています。

joaquimscosta/arkhe-claude-plugins212026年8月14日 更新

Zero-dependency live-preview server providing an agent↔browser bidirectional companion. Watches a content directory, wraps HTML fragments in a frame template, broadcasts live-reload over WebSocket, and captures browser-side click events to a JSONL file. Use when an agent needs to show HTML to the user in a browser and react to clicks — mockups, design exploration, gallery browsing, multi-select choices, prototype iteration. Triggered by "live preview", "browser companion", "preview server", "browser mockup", "show in browser", "arkhe-preview", or any skill that wants to write HTML fragments and have the user see them reload in real time.

日本語の概要は準備中です。原文の説明を表示しています。

joaquimscosta/arkhe-claude-plugins212026年8月14日 更新

Deletes 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.

日本語の概要は準備中です。原文の説明を表示しています。

joaquimscosta/arkhe-claude-plugins212026年8月14日 更新

Interactive Claude Code environment setup wizard. Detects existing configuration, guides through best-practice setup for Global CLAUDE.md, project scaffolding, MCP servers, hooks, custom agents, keybindings, and settings. Use when user runs /devtools:code-env-setup, mentions "setup claude code", "configure claude", "claude code setup", "environment setup", or "initialize claude code".

日本語の概要は準備中です。原文の説明を表示しています。

joaquimscosta/arkhe-claude-plugins212026年8月14日 更新

joaquimscosta のスキルをすべて見る

このスキルの問題を報告する