Use before any file edit in a session when worktree preference has not yet been confirmed — asks whether to open a new worktree, records the choice once per session, and delegates setup to using-git-worktrees when accepted
How this skill is triggered — by the user, by Claude, or both
Slash command
/superpowers-deepseek-v4:confirming-worktree-before-editThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Before modifying any file in this session, confirm whether the user wants an isolated worktree — but only once per session.
Before modifying any file in this session, confirm whether the user wants an isolated worktree — but only once per session.
Core principle: Ask once. Record the choice. Delegate setup. Never edit before the gate when consent is still unknown.
Scope: All persistent writes to project files, including:
docs/superpowers/specs/*.mddocs/superpowers/plans/*.mddocs/superpowers/brainstorms/*-brainstorm.mddocs/superpowers/brainstorms/*-plan-progress.mdAnnounce at start: "I'm using the confirming-worktree-before-edit skill to confirm worktree preference before editing."
Do NOT run this gate when any of these apply:
Read-only mode — Ask mode or any context where file edits are technically impossible (Write/StrReplace/ApplyPatch and equivalent tools unavailable). Skip entirely. Plan mode does not skip this gate when edits are possible.
Subagent dispatch — If you were dispatched as a subagent (<SUBAGENT-STOP> in using-superpowers), skip. The parent agent must run this gate before dispatching you.
Already in a linked worktree — Run detection (same as using-git-worktrees Step 0):
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)
# Submodule guard — if this returns a path, treat as normal repo, not worktree
git rev-parse --show-superproject-working-tree 2>/dev/null
If GIT_DIR != GIT_COMMON (and not a submodule): already isolated. Record worktree consent: asked, choice: skipped (already in worktree) and proceed to Step 4.
User already declared worktree preference — User rules, instructions, or an earlier message in this session explicitly state worktree preference (create one / work in place / use /worktree). Honor it. Record worktree consent: asked, choice: yes|no matching that preference. Proceed to Step 3 or Step 4 as appropriate.
Consent already recorded this session — If you already recorded worktree consent: asked, choice: ... in this session, skip to Step 4. Never ask twice.
You are about to edit a file and none of the Step 0 skip conditions apply.
STOP. Do not edit any file yet.
Ask the user using this exact wording:
Would you like me to set up an isolated worktree? It protects your current branch from changes.
Wait for the user's answer before proceeding.
Immediately after the user answers, record in your session notes:
worktree consent: asked, choice: yes
or
worktree consent: asked, choice: no
This record prevents duplicate asks for the rest of the session. Other skills (including using-git-worktrees) rely on it.
If choice is yes:
REQUIRED SUB-SKILL: Use superpowers-deepseek-v4:using-git-worktrees
Do not call git worktree add directly — using-git-worktrees handles native tools, paths, setup, and baseline tests.
If choice is no:
Work in the current directory. Proceed to Step 4 without creating a worktree.
Gate complete. Continue the calling skill's edit workflow (TDD, plan execution, spec writing, debugging fix, etc.).
| Situation | Action |
|---|---|
| Read-only / Ask mode (edits impossible) | Skip gate |
| Subagent | Skip (parent runs gate) |
| Already in linked worktree | Record skipped, proceed |
| User rules declare preference | Honor + record, no ask |
| Consent already recorded | Skip ask, proceed |
| First edit (spec/plan/source/config), none of above | Ask exact question, record, execute |
| User says yes | Invoke using-git-worktrees |
| User says no | Work in place |
git worktree add after user says yes/worktree or EnterWorktree; agent still asksNever:
git worktree add when a native harness worktree tool exists (using-git-worktrees owns this)Always:
Called by: session bootstrap (before using-superpowers), brainstorming (Step 0.5), writing-plans (Step 0.5), test-driven-development, subagent-driven-development, executing-plans, systematic-debugging (Phase 4), dispatching-parallel-agents, receiving-code-review, writing-skills, resume-brainstorming (abandonment edit), resume-planning (abandonment edit), and using-superpowers (ad-hoc edits).
Delegates to: superpowers-deepseek-v4:using-git-worktrees (when user accepts)
npx claudepluginhub gylove1994/superpowers-deepseek-v4 --plugin superpowers-deepseek-v4Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.