git-worktrees
Git worktree management for parallel agent team development. Triggers: 'create worktree', 'worktree setup', or during /delegate dispatch. Do NOT use for…
от lvlup-sw★ 19 звёзд на GitHub
Установить git-worktrees в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Git Worktrees Skill
Overview
Create and manage isolated git worktrees for parallel development tasks. This is harness work with git. No Remit call makes, checks or removes a worktree. Settlement observes the worktree that each claim names.
Triggers
Activate this skill when:
- Multiple tasks can run in parallel
- User runs
delegatewith parallelizable tasks - Need isolated environment for subagent work
- User explicitly requests worktree setup
Worktree Directory Location
Priority Order:
.worktrees/- If exists and gitignoredworktrees/- If exists and gitignored- Check
CLAUDE.mdfor project conventions - Ask user if unclear
Safety Check (REQUIRED):
# Verify directory is gitignored before creating
git check-ignore -q .worktrees && echo "Safe" || echo "NOT GITIGNORED"
If not gitignored, add to .gitignore:
.worktrees/
Worktree Lifecycle
1. Create Worktree
# Create feature branch
git branch feature/task-name main
# Create worktree
git worktree add .worktrees/task-name feature/task-name
# Verify creation
git worktree list
Naming Convention: .worktrees/<task-id>-<brief-name>
- Example:
.worktrees/001-user-auth - Example:
.worktrees/002-api-endpoints
2. Setup Environment
See references/commands-reference.md for the full environment setup table and scripts per project type.
3. Baseline Verification
Run the baseline tests with the project test command in the worktree, to confirm that it is ready:
cd .worktrees/task-name && <project test command>
Take the test command from .remit.yml (test), or from the task runner of the project (npm run test:run, cargo test, go test ./..., pytest, dotnet test).
On a pass: the worktree is ready for implementation. On a failure, or no test command: investigate before you continue.
If baseline fails:
- Check if main branch has failing tests
- Report issue to user
- Do not proceed with implementation
4. Work in Worktree
Subagents work in worktree directory:
- Full isolation from other tasks
- Commits go to feature branch
- Can run tests independently
5. Cleanup After Merge
# After PR merged, remove worktree
git worktree remove .worktrees/task-name
# Optionally delete branch
git branch -d feature/task-name
# Prune stale worktree refs
git worktree prune
Parallel Worktree Management
See references/commands-reference.md for parallel worktree creation examples, tracking format, and the full commands reference table.
Worktree Validation
Why Validate?
Subagents MUST verify they're in a worktree before making changes. Working in the main project root causes:
- Merge conflicts between parallel tasks
- Accidental changes to shared state
- Build/test interference
Worktree Verification
Check the worktree with git before any file change:
pwd
git rev-parse --show-toplevel
git rev-parse --git-common-dir
The path must be under .worktrees/, the top level must be that path, and the common dir must be the .git of the main repository. When a check fails, you are NOT in a linked worktree: STOP at once, and do not change a file.
Subagent Instructions
Include in all implementer prompts:
## CRITICAL: Worktree Verification (MANDATORY)
Before making ANY file changes, run `pwd` and confirm that the path is under `.worktrees/`.
If it is not: STOP and report an error.
DO NOT proceed with any modifications outside a worktree.
Anti-Patterns
| Don't | Do Instead |
|---|---|
| Create worktrees in tracked directory | Use gitignored .worktrees/ |
| Skip baseline test verification | Always verify tests pass first |
| Leave stale worktrees | Clean up after merge |
| Forget dependency installation | Run project setup in each worktree |
| Mix work across worktrees | One task per worktree |
Integration with Delegation
When delegation skill spawns parallel tasks:
- Create worktree for each parallel group
- Set up environment
- Verify baseline tests
- Dispatch subagent with worktree path
- Track progress
- Land the head of each task on the integration ref through the harness, one worktree at a time, in dependency order, before the review and the settle
- Clean up each worktree after its accepted head has landed
Landing Handoff
The coordinator lands the head of each task through its harness, as the delegate skill describes (@skills/delegate/SKILL.md, section "Land each head on the integration ref"). It lands each head on settlementContract.integration.ref before the review and before the settle, because the critic and the synthesis boundary read the integration tip. It lands one head at a time, in dependency order, from the integration checkout with an empty git status --porcelain. Use a fast-forward or a merge commit, for example git merge --no-edit <task branch>. Never squash or rebase a head: the landed commit then holds no claimed head,
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/commands-reference.md
FAQ
Что делает скилл git-worktrees?
Git worktree management for parallel agent team development. Triggers: 'create worktree', 'worktree setup', or during /delegate dispatch. Do NOT use for branch creation without delegation context.
Как установить скилл git-worktrees?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл git-worktrees запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
AnthropicGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
academy-guide
AnthropicStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
internal-comms
AnthropicA set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
skill-development
AnthropicThis skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…