Setup Feature Worktrees
Prepare local worktrees after a branch plan exists. UTILITY SKILL. INVOKES: scripts/setup_worktrees.py, setup-worktree-database, git, optional code.
Read worktree setup playbook before mutating git state.
USE FOR:
- Direct
$setup-feature-worktreesrequests. - Creating planned branches/worktrees from updated
mainor another base. - Setting up extra Rails worktrees with isolated databases and shared task links.
DO NOT USE FOR:
- Planning branches; use
plan-feature-branches. - Implementing or committing; use
implement-in-logical-commits. - Delegating existing worktrees; use
delegate-feature-branches. - Publishing PRs, monitoring CI, resolving conflicts, or database-only setup.
Required Behavior
- Require a branch plan or ordered branch names.
- Inspect status, current branch, remotes, and worktrees before mutations.
- Update the base with fetch/switch/pull
--ff-only; defaultmain/origin. - Run
scripts/setup_worktrees.pywithout editor launch; branch from the updated base only. - Reuse the current worktree only for the first planned branch and only when clean.
- For each
created_worktree: true, invokesetup-worktree-databasebefore editors. - Then open
code -n <worktree>when available; report and continue if unavailable.
Output
Return branch names, paths, reused/created worktrees, database/task-link results, editor status, and blockers.
Troubleshooting
- Dirty current worktree: do not repurpose it.
- Existing non-worktree path: stop and report it.
- Missing
code: continue without editor launch.