← スキル一覧に戻る

git-worktrees
by mway
⭐ 4🍴 0📅 2026年1月22日
SKILL.md
name: git-worktrees description: Use when starting work that needs isolated branches or parallel feature development using git worktrees. allowed-tools: ["shell", "read_file"] metadata: short-description: Create and manage git worktrees safely
Git Worktrees
Read these references:
~/.config/agent/core/behavior.md- Safety and verification~/.config/agent/core/methodology.md- Structured workflow
Overview
Git worktrees provide isolated working directories for parallel branches without switching context.
Core principle: Safe directory selection + verification before use.
Directory Selection
- Prefer existing
.worktrees/(hidden) - Else use
worktrees/if present - Else check
CLAUDE.mdfor guidance - Else ask user for preferred location
Safety Verification
For project-local worktrees:
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null
If not ignored, add to .gitignore before continuing.
Create Worktree
project=$(basename "$(git rev-parse --show-toplevel)")
# Choose path based on directory selection
# Example (project-local):
path=".worktrees/<branch-name>"
# Preflight checks
if [ -e "$path" ]; then
echo "Error: $path already exists" >&2
# Ask user whether to reuse or choose a new path
fi
if git show-ref --verify --quiet refs/heads/<branch-name>; then
echo "Warning: branch <branch-name> already exists" >&2
# Ask user whether to reuse or choose a new name
fi
git worktree add "$path" -b <branch-name>
cd "$path"
Project Setup
Auto-detect and run setup:
if [ -f package.json ]; then npm install; fi
if [ -f Cargo.toml ]; then cargo build; fi
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f pyproject.toml ]; then poetry install; fi
if [ -f go.mod ]; then go mod download; fi
Baseline Verification
Run the project’s standard tests. If failures occur, report and ask whether to proceed or investigate.
Arguments
Target: ${ARGUMENTS}
スコア
総合スコア
40/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です