Update a WIP implementation plan by inserting a Phase 0 that creates a git branch and worktree, switches to it, and moves any WIP work from the current working copy into the new worktree. Use when asked to add worktree setup to a plan, when invoked as /plan:worktree, or when a plan should execute in an isolated checkout.
98%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Announce at start: "Using plan-worktree skill to add a Phase 0 worktree setup to ."
Takes a WIP plan (default: PLAN.md at the repo root, or the path the user names) and prepends a Phase 0: Worktree Setup that isolates plan execution in a git worktree, carrying over any uncommitted work already in progress.
PLAN.md at repo root).ben/<slug> per repo convention); confirm with the user if ambiguous.Read the plan file. Note:
**Files:** blocks) so Phase 0 matches it.git status --porcelain=v1
git branch --show-currentgit stash push -u -m "wip: <plan-slug>" in the current checkout, create the worktree, then pop that entry, found by its message, inside the new worktree. (Stash-then-pop is the only safe cross-worktree move; never copy files by hand.)PLAN.md itself is untracked, the -u flag covers it; call this out in the step.Insert immediately after the plan header block (after the --- following Goal/Architecture/Tech Stack), before the first existing phase/task. Match the plan's existing step style. Required content:
## Phase 0: Worktree Setup
**Files:**
- Modify: none (workspace setup only)
- [ ] **Step 1: Stash any WIP in the current checkout** (skip if `git status --porcelain` is empty)
Run: `git stash push -u -m "wip: <plan-slug>"`
Expected: `Saved working directory and index state …` (includes untracked files, e.g. PLAN.md if untracked)
- [ ] **Step 2: Create branch and worktree via the git-worktree skill**
REQUIRED SUB-SKILL: `git-worktree`
```bash
git branch <branch> <base-branch> # skip if <branch> already exists
wt switch <branch>
```
`wt switch` has no base option: it checks out an existing local branch, so the `git branch` line is what applies `<base-branch>`. If `<branch>` already existed, it is used as is and the report says so instead of naming a base. Creates the worktree and prints its path (`wt path <branch>`). From here, every command runs with the worktree as cwd; every file path is absolute under it; every subagent prompt states the worktree path (subagents inherit the parent cwd).
- [ ] **Step 3: Restore the WIP into the worktree** (skip if Step 1 was skipped)
Find the entry: `git stash list` and note the `stash@{n}` whose message ends in `wip: <plan-slug>`. The stash list is shared by every worktree of the repo, so it may not be `stash@{0}`.
Run: `git stash pop stash@{n}` (inside the worktree)
Expected: the stashed changes reappear in `git status`, and the successful pop drops the entry. Only if the pop stops on a conflict: resolve it, then run `git stash drop stash@{n}`.
- [ ] **Step 4: Rebase the session onto the worktree**
Follow the git-worktree skill's Session Rebase Protocol: bind all tool calls to the worktree path (part A), and print the one-line harness command for the user (omp: `/move <wt_path>`; claude: `/add-dir <wt_path>`). Do not block on the user running it.
- [ ] **Step 5: Verify baseline**
Run the repo's fast check (e.g. `just check` or `wt verify <branch>`) to confirm the worktree starts green before Phase 1 changes anything.Substitute real values for <plan-slug>, <branch>, <base-branch>.
git-worktree skill; path derivation never goes in the plan prose.~/.worktrees/... paths in the plan beyond referencing the wt CLI's printed path; wt path <branch> is the single source of truth.git worktree add directly in plan steps — the git-worktree skill owns creation and session rebasing.phatblat/dotfiles
4d65cab
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.