← ClaudeAtlas

subagent-conflict-detectionlisted

Use before dispatching a subagent with `isolation:"worktree"`, or while another subagent is in flight, to avoid three dispatch hazards — file-scope overlap with an in-flight subagent, a stale dispatch base, and collisions with another live agent/session editing the same checkout or git-submodule path. Invoke when about to call the Agent tool with `isolation:"worktree"`; when another subagent is running; right after a merge or branch switch; or when another Claude session is editing a shared repo/submodule path. Does NOT cover PR / merge mechanics (github-contribution-workflow) or post-commit diff sanity (pr-diff-verification).
wei18/apple-dev-skills · ★ 18 · AI & Automation · score 81
Install: claude install-skill wei18/apple-dev-skills
# Subagent Conflict Detection ## Native mechanism Claude Code's own isolation primitives are the [Subagents](https://code.claude.com/docs/en/subagents) feature ("each subagent runs in its own context window with a custom system prompt, specific tool access, and independent permissions") and `isolation:"worktree"`'s [base-branch selection](https://code.claude.com/docs/en/worktrees#choose-the-base-branch). Neither one checks whether a NEW dispatch's file scope overlaps an in-flight one, or whether the worktree base is stale — that pre-flight discipline is what this skill adds on top. - Official sources: when verifying or updating a factual or version-sensitive claim, read `references/official-docs.md`. ## When to invoke Before dispatching a new subagent via the Agent tool — especially with `isolation: "worktree"` — if ANY other subagent is currently running or has an active worktree. Trigger phrases / situations: - "派 subagent" / "dispatch a subagent" / "再派一個" while a prior subagent is in flight - About to call `Agent` tool when `git worktree list` shows non-main worktrees - Multiple `[in_progress]` tasks in TaskList that involve subagent work Skip when: dispatching the first subagent in a session, or all prior subagents have completed AND their worktrees are cleaned/merged. ## The pattern (3-step pre-dispatch check) ### Step 1 — inventory in-flight subagents ```bash git worktree list --porcelain | grep '^worktree ' | cut -d' ' -f2- | tail -n +2 ``` Plain `git worktr