skills/worktree-isolation/SKILL.md
Worktree isolation methodology — loaded by the router to run the entire Team pipeline in one or more isolated git worktrees, enabling parallel /team runs and features that span multiple repositories
npx skillsauth add bostonaholic/team worktree-isolationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Every /team pipeline run operates in one or more isolated git
worktrees — one per repository the topic touches. The worktree boundary
is at the router level — not per-agent. This means:
/team runs can execute simultaneously
without file conflicts. Each gets its own worktree(s).docs/plans/<id>/repos.md.
The router creates a worktree in each, branched off the same <id>.When docs/plans/<id>/repos.md is absent, the topic touches only the
home repo (the repo the user invoked /team from). The router creates
exactly one worktree using Claude Code's native worktree support:
<repo>/.claude/worktrees/<id><id>, branched from the default remote branch (origin/HEAD)No custom worktree creation, path management, or teardown logic is needed.
When docs/plans/<id>/repos.md is present, the topic spans multiple
repos. The router creates one worktree per listed repo, all sharing
the same branch name <id>:
<repo-path> in repos.md:
<repo-path>/.claude/worktrees/<id><id>, branched from that repo's origin/HEADgit -C <repo-path> worktree add .claude/worktrees/<id> -b <id> origin/HEADdocs/plans/<id>/
artifact directory. The other repos' worktrees do not duplicate the
artifacts; agents that need them read from the home worktree's path,
which the orchestrator passes in.After all worktrees are created, the orchestrator appends a ## Worktrees
section to repos.md recording the per-repo worktree paths. Any later
/team-* invocation rediscovers them by reading that one file.
For the home repo, Claude Code has built-in worktree support (--worktree <topic> or dispatch into a worktree context). For additional repos in
multi-repo mode, the router uses plain git worktree add because Claude
Code's native flag only knows about the repo it was launched from. Either
mechanism produces a standard git worktree — there is no behavioral
difference downstream.
Worktree creation runs at the WORKTREE phase — phase 6 of 8, after PLAN and before IMPLEMENT (see Why late below for the rationale). The router's responsibilities at this phase are:
repos.md is present, create
a worktree in each additional repo it lists (same <id> branch
in each).docs/plans/<id>/ into the home worktree
after creation (see "Carry the artifact directory into the home
worktree" in skills/team-worktree/SKILL.md). In multi-repo mode
only the home worktree gets the copy.[repo: <name>] annotation). The durable inter-agent protocol is
the artifact files under the home worktree's docs/plans/<id>/
directory; live coordination uses TodoWrite (session-scoped).Worktree creation lands at phase 6 rather than phase 0 for two load-bearing reasons.
First, the two human gates — DESIGN and STRUCTURE — are reviewed on
the home tree where the user invoked /team. That is the same
context any reviewer already has open; moving those gates inside a
worktree would force a cd or git worktree list before reading
the artifact in an editor.
Second, branch scope is a Plan output, not a Setup-time guess. By the time WORKTREE runs the structure has been approved and the plan exists, so the branch name and (in multi-repo mode) the per-repo worktree set are derivable from artifacts rather than guessed.
Together these make phase-6 placement a deliberate, articulable choice rather than inertia.
All agents — researcher, planner, test-architect, implementer, reviewers — run inside whichever worktree the orchestrator hands them for the current slice or step. In single-repo mode that is always the home worktree. In multi-repo mode the implementer changes directory between repos as the plan steps require, committing each slice in the worktree where its files live. Main working trees are never touched.
Opening a PR does not tear down the worktree — the user may need to iterate on the branch (push follow-up commits, address review feedback). Keep the worktree until the PR is merged or the user explicitly asks to remove it. The same holds when commits are kept locally without a PR.
When teardown is warranted (post-merge or on explicit request):
git worktree remove) remove the worktree.git -C <repo-path> worktree remove <worktree-path> and git -C <repo-path> branch -D <id>.git -C <repo-path> pull --rebase origin <base>.
Always rebase — never a merge commit — so history stays linear.Git worktrees are fresh checkouts — they don't include untracked files like
.env or .env.local. To copy these automatically, add a .worktreeinclude
file to the project root using .gitignore syntax:
.env
.env.local
Only files matching a pattern that are also gitignored get copied. In
multi-repo mode, each repo honors its own .worktreeinclude independently.
If worktree creation fails in any repo (shallow clones, certain CI systems):
Never block the pipeline because worktree creation failed — isolation is a best-practice enhancement, not a hard requirement.
data-ai
Todo-first progress convention for multi-step procedures — loaded by every multi-step agent to track its own steps without drift
testing
Adversarially review a technical design document with fresh context before the human gate. Dispatches the built-in `general-purpose` subagent (clean context, no shared history with the design-author) against `docs/plans/<id>/design.md` and presents its verdict — APPROVE, REQUEST CHANGES, or COMMENT. Optional, not part of the QRSPI pipeline. Trigger on "review the design doc", "audit design.md", "is this design ready", or `/eng-design-doc-review`.
development
Generator-evaluator separation and review methodology — loaded by review agents to enforce fresh-context review discipline, Conventional Comments format, and gate verdicts
data-ai
Prepare one or more isolated git worktrees — one per repository the topic touches. Router action — no agent. Trigger on "set up the worktree", "isolate this work", or "/team-worktree".