← 教程列表
实战📊 中级🛠 AI赚钱

1. `using-git-worktrees/SKILL.md` — Add Step 0 (~12 lines)

📅 2026/6/14 15:43:48⏱ 约 5 分钟阅读👁 7 阅读

New section between "Overview" and "Directory Selection Process": **Step 0: Check if Already in an Isolated Workspace** Run the detection commands. If `GIT_DIR != GIT_COMMON`, skip worktree creation entirely. Instead: 1. Skip to "Run Project Setup" subsection under Creation Steps — `npm install` etc. is idempotent, worth running for safety 2. Then "Verify Clean Baseline" — run tests 3. Report with branch state: - On a branch: "Already in an isolated workspace at `` on branch ``. Tests passing. Ready to implement." - Detached HEAD: "Already in an isolated workspace at `` (detached HEAD, externally managed). Tests passing. Note: branch creation needed at finish time. Ready to implement." If `GIT_DIR == GIT_COMMON`, proceed with the full worktree creation flow (unchanged). Safety verification (.gitignore check) is skipped when Step 0 fires — irrelevant for externally-created worktrees. Update the Integration section's "Called by" entries. Change the description on each from context-specific text to: "Ensures isolated workspace (creates one or verifies existing)". For example, the `subagent-driven-development` entry changes from "REQUIRED: Set up isolated workspace before starting" to "REQUIRED: Ensures isolated workspace (creates one or verifies existing)". **Sandbox fallback:** If `GIT_DIR == GIT_COMMON` and the skill proceeds to Creation Steps, but `git worktree add -b` fails with a permission error (e.g., Seatbelt sandbox denial), treat this as a late-detected restricted environment. Fall back to the Step 0 "already in workspace" behavior — skip creation, run setup and baseline tests in the current directory, report accordingly. After reporting in Step 0, STOP. Do not continue to Directory Selection or Creation Steps. **Everything else unchanged:** Directory Selection, Safety Verification, Creation Steps, Project Setup, Baseline Tests, Quick Reference, Common Mistakes, Red Flags.

← 返回教程列表 AI8899 · 内容仅供学习参考