← ClaudeAtlas

parallel-task-worktreelisted

Use this skill BEFORE spawning two or more parallel code-editing sub-agents on the same repository. It creates an isolated `git worktree` for each task so the agents cannot stomp on each other via `git checkout` / `git reset` / `git add -A`. Each worktree lives at `<repo>/../<repo-name>-task-<id>` on its own `task/<id>` branch, and is removed with a single `git worktree remove` once the task ends. Skip this skill only when exactly one code task will touch the repo. See ADR-0018.
ttamakijp/dev-templates · ★ 0 · AI & Automation · score 74
Install: claude install-skill ttamakijp/dev-templates
# parallel-task-worktree ## Overview ADR-0018 の空間軸 hygiene skill。同一 repo に複数 code task を並行 spawn するとき、各 task に独立した working tree を用意して race condition を 構造的に消す。 **Keywords**: worktree, parallel, isolation, ADR-0018, race condition, multi-agent, sub-agent, git checkout, git reset ## Trigger Invoke when ANY of: - `Agent` ツールで 2 つ以上の code task を **同時** に spawn する直前 - Cowork / Dispatch で child session が並行コード編集を始めるとき - 複数 branch を同じ clone 内で並行 build する直前 - User が "並行で実装" / "サブエージェントで分担" 等の依頼をしたとき Skip when: - 編集する code task が単一の場合 (worktree オーバーヘッド不要) - 読み取り専用 task (grep / Read / analysis のみ) の場合 ## 5 Phase 進行 ### Phase 1: 並行性の確認 並行 task が **2 つ以上 同時に** code 編集するかを確認: ``` - 単一 task → skill を抜ける (worktree 不要) - 並行 task ≥ 2 → Phase 2 へ ``` ### Phase 2: task-id の払い出し 各 task に短い id を割り当てる: - 形式: `^[A-Za-z0-9_-]+$` (空白 / 記号は不可) - 推奨命名: `<scope>-<short>` (例: `auth-refactor`, `bug-35`) - 衝突回避: 既存 `<repo>-task-<id>` ディレクトリの有無を確認 ### Phase 3: worktree 作成 各 task について: ```bash # bash / WSL / macOS WORKTREE_PATH=$(bash scripts/create-task-worktree.sh <repo-path> <task-id>) # 出力: <repo-path>/../<repo-name>-task-<task-id> ``` ```powershell # Windows $WorktreePath = pwsh scripts/create-task-worktree.ps1 ` -RepoPath <repo-path> -TaskId <task-id> ``` base-branch ��既定 `main`。別 branch を起点にする場合は第 3 引数 / `-BaseBranch` で明示: ```bash bash scripts/create-task-worktree.sh <repo-path> <task-id> release/v3.5 ``` エラー時: - WORKTREE_001: 引数 / repo path 不正 - WORKTREE_002: worktree path 既存 (