/superbeads:using-git-worktreesfrom superbeads
Use when implementation work needs an isolated Beads-aware Git worktree.
Ships in superbeads. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Git worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching.
Core principle: Systematic directory selection + safety verification = reliable isolation.
Announce at start: "I'm using the using-git-worktrees skill to set up an isolated workspace."
bd worktree, NOT git worktreeALWAYS use bd worktree commands. NEVER use raw git worktree commands.
Why: bd worktree create does everything git worktree add does PLUS:
.gitignore automaticallyRaw git worktree add misses .gitignore setup and safety checks — while beads database sharing works via git common directory, you lose the automation bd worktree create provides.
| Action | Use This | NOT This |
|---|---|---|
| Create worktree | bd worktree create .worktrees/<name> | git worktree add |
| List worktrees | bd worktree list | git worktree list |
| Remove worktree | bd worktree remove <name> | git worktree remove |
| Worktree info | bd worktree info |
Note: Claude Code provides a native
EnterWorktreetool for worktree management. For non-beads projects, this is a viable alternative. For beads-integrated projects,bd worktree createremains mandatory — it handles database sharing and.gitignoremanagement thatEnterWorktreedoes not provide.Deliberate divergence from upstream: superpowers v6.0.3 rewrote this skill to prefer the harness-native worktree tool first (
EnterWorktree→ existing.worktrees/→ rawgit worktree). We do not adopt that native-tool-first selection order — it bypassesbd worktree's beads-database sharing across worktrees. The Iron Law above (alwaysbd worktree) is intentional and takes precedence.
Always create project worktrees under .worktrees/ by passing the full path to bd worktree create:
bd worktree create .worktrees/<name> for every worktree pathbd worktree create <name>; beads defaults to ./<name>, which pollutes the repository rootbd worktree create adds the path to .gitignore automaticallyFor this skill, .worktrees/<name> is the project worktree directory. Do not substitute the bd default path.
bd worktree create automatically adds the worktree path to .gitignore when inside the repo root. Verify as a safety net:
git check-ignore -q <worktree-path> 2>/dev/null
If NOT ignored (edge case — bd worktree create should have handled this): add the path to .gitignore and commit.
Run these checks BEFORE creating any worktree.
Check whether you are already inside a worktree:
GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
if [ "$GIT_DIR" != "$GIT_COMMON" ]; then
echo "WARNING: Already inside a worktree."
fi
If already in a worktree, warn and ask via your structured question tool whether to proceed (creating a nested worktree) or abort.
Check whether you are inside a git submodule:
SUPERPROJECT=$(git rev-parse --show-superproject-working-tree 2>/dev/null)
if [ -n "$SUPERPROJECT" ]; then
echo "WARNING: Inside a git submodule. Worktrees behave unpredictably here."
fi
If inside a submodule, warn and stop. Do NOT create worktrees inside submodules.
<path>. Proceed?"Before creating the worktree, claim the issue you're about to work on. This prevents ownerless work — you own the bead before any environment exists.
bd update <issue-id> --claim
Before this workflow's first Beads read/write or claim decision, read Beads Read/Write Economy and Claim Boundary; do not load it when no tracker operation is needed.
bd worktree create# Simple — creates worktree at .worktrees/<name> with matching branch
bd worktree create .worktrees/<feature-name>
# With explicit branch name
bd worktree create .worktrees/<feature-name> --branch <branch-name>
# Then cd into it
cd .worktrees/<feature-name>
What bd worktree create does automatically:
.gitignore (if inside repo root)Auto-detect and run appropriate setup:
# Node.js
if [ -f package.json ]; then npm install; fi
# Rust
if [ -f Cargo.toml ]; then cargo build; fi
# Python
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f pyproject.toml ]; then poetry install; fi
# Go
if [ -f go.mod ]; then go mod download; fi
Run tests to ensure worktree starts clean:
# Examples - use project-appropriate command
npm test
cargo test
pytest
go test ./...
If tests fail: Report failures, then use your structured question tool to ask: Question: "Baseline tests failing in worktree ( failures). How should I proceed?" Options: "Investigate failures" (debug before starting feature work), "Proceed anyway" (start implementation despite pre-existing failures) A skipped, dismissed, or auto-resolved answer is not consent — stop and ask in plain text.
If tests pass: Report ready.
Worktree ready at <full-path>
Tests passing (<N> tests, 0 failures)
Ready to implement <feature-name>
When Subagent-Driven Development runs independent tasks in parallel, the orchestrator creates and manages multiple worktrees. Subagents never create or destroy worktrees — they receive a path and work within it.
Pattern:
# 1. Orchestrator creates epic worktree (once)
bd worktree create .worktrees/<epic-name>
# 2. For each parallel task (max 5 concurrent):
bd worktree create .worktrees/<task-name> --branch feature/<epic>/<task>
# 3. Subagent receives path in its prompt:
# "Work from: <task-worktree-path>"
# 4. After task passes review — orchestrator merges and cleans up:
cd <epic-worktree-path>
git merge feature/<epic>/<task>
bd worktree remove <task-name>
Constraints:
bd worktree commandsSee also: superbeads:subagent-driven-development → Parallel Batch Mode section for the full orchestration flow.
| Situation | Action |
|---|---|
| Creating a worktree | bd worktree create .worktrees/<name> — always use .worktrees/* |
| Custom location temptation | Do not use another path; keep .worktrees/<name> |
| Directory not ignored | Add to .gitignore + commit (edge case) |
| Tests fail during baseline | Report failures + ask |
| No package.json/Cargo.toml | Skip dependency install |
| Parallel subagent work | Create one bd worktree per task, orchestrator manages lifecycle (max 5) |
| Working across worktrees | bd -C .worktrees/<name> ready — run bd in a worktree without cd |
git worktree instead of bd worktreegit worktree add misses .gitignore setup and safety checks — while beads database sharing works via git common directory, you lose the automation bd worktree create providesbd worktree create. If you catch yourself typing git worktree, stop and use bd worktree instead.git check-ignore after creation (bd worktree create handles this automatically, but verify as a safety net)bd worktree create default path logicbd worktree create <name> creates at ./<name>, cluttering the repository root.worktrees/<name> path: bd worktree create .worktrees/<name>You: I'm using the using-git-worktrees skill to set up an isolated workspace.
[Create worktree: bd worktree create .worktrees/auth --branch feature/auth]
✓ Created worktree at .worktrees/auth
✓ Beads database shared via git common directory
✓ Added to .gitignore
[cd .worktrees/auth]
[Run npm install]
[Run npm test - 47 passing]
Worktree ready at /Users/jesse/myproject/.worktrees/auth
Tests passing (47 tests, 0 failures)
Ready to implement auth feature
When this workflow closes after producing durable insights, read Durable Memory and apply it; otherwise do not load it.
Never:
git worktree commands — ALWAYS use bd worktree.worktrees/*Always:
bd worktree create / bd worktree list / bd worktree remove.worktrees/<name> as the worktree pathInvoked by: Any task needing workspace isolation, or user on-demand.
Required by:
Pairs with: subagent-driven-development — parallel batch mode creates multiple worktrees (one per task) for concurrent subagent execution.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub the-inconvenience-store/superbeads --plugin superbeads23 skills in this plugin
/brainstormingUse when shaping a feature, component, or behavior change into an approved solution design./dispatching-parallel-agentsUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies/document-releaseUse when committed code is awaiting merge and its project documentation may be stale./executing-plansUse when a validated implementation graph must run without isolated subagents./finishing-a-development-branchUse when implementation work has reached a terminal branch state and the user must choose merge, PR, keep, or discard/getting-up-to-speedUse when an unfamiliar, stale, compacted, or unclear project session needs orientation.