subagent-conflict-detectionlisted
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