git-worktree-discipline
Skill6 starsChanged 6 days agoMITView on GitHub
Pre-write (docs or code) git/native worktree isolation with worktree-gate (always|never|ask; unset≡ask): detect reuse (incl. submodule guard), recommend suitability, create (native then ignored .worktrees/), setup+baseline, or decline/lean with 留痕; cleanup via feature-branch-closeout. Triggers — 「git worktree」「工作区隔离」「隔离工作区」「执行前隔离」「worktree 门控」 / git worktree discipline. Do NOT use as Superpowers using-git-worktrees alias or for closeout destroy.
In this repository79 other files it gives its agents.
- AGENTS.mdAGENTS.md
- openspec-apply-changeSkill
- openspec-archive-changeSkill
- openspec-bulk-archive-changeSkill
- openspec-continue-changeSkill
- openspec-exploreSkill
- openspec-ff-changeSkill
- openspec-new-changeSkill
- openspec-onboardSkill
- openspec-sync-specsSkill
- openspec-verify-changeSkill
- ai-proxy-disciplineSkill
- analysis-coreSkill
- android-webview-debugSkill
- article-writerSkill
- astrill-controlSkill
- brainstorm-workflowSkill
- browser-debug-toolkitSkill
- clarifying-question-disciplineSkill
- code-design-reviewSkill
- competitive-researchSkill
- completion-evidence-disciplineSkill
- context-budget-disciplineSkill
- decision-fog-disciplineSkill
- delivery-disciplineSkill
- design-approval-gateSkill
- domain-language-disciplineSkill
- effective-web-researchSkill
- essence-diagnosisSkill
- evolution-reviewSkill
- explain-clearlySkill
- feature-branch-closeoutSkill
- figma-pixel-implementSkill
- figma-pixel-verifySkill
- git-branch-protectSkill
- git-commitSkill
- git-conflict-resolveSkill
- git-release-finishSkill
- git-release-startSkill
- goal-driven-queueSkill
- goal-driven-workflowSkill
- go-deploySkill
- hybrid-debugSkill
- intake-interview-disciplineSkill
- jira-fix-queueSkill
- jira-fix-workflowSkill
- jira-readSkill
- jira-status-lifecycleSkill
- jira-status-writebackSkill
- jira-wiki-markupSkill
- known-issue-researchSkill
- learn-and-improveSkill
- merge-disciplineSkill
- multi-agent-debateSkill
- node-version-disciplineSkill
- opsx-jira-fix-queueSkill
- opsx-jira-fix-workflowSkill
- opsx-solve-workflowSkill
- opsx-workspace-gateSkill
- perf-optimize-workflowSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 16
Before the first non-trivial persistent write (docs or code) in the host run.
- Distinctive: line 31
Do not replace design approval.
- Very specific: line 35
Destroy/remove: after verify/archive → feature-branch-closeout optional cleanup.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Git Worktree Discipline
Internal shared skill. Optional create/detect isolation before the first non-trivial write (docs or code). Hosts declare it in
dependenciesand abort if missing.Name note: intentionally not named
using-git-worktrees. Usegit-worktree-disciplineonly. Operational create/detect/setup details live inreference.md(inspired by common worktree practice; no external skill dependency).
When to run
Before the first non-trivial persistent write (docs or code) in the host run. Skip the create offer only when already isolated for this change, or gate/never, or lean/hotfix in-place 留痕 this session.
Loop
- Detect — already in a linked worktree for this change? Reuse (do not nest). Distinguish submodule from worktree before concluding isolation. Commands:
reference.md. - Resolve preference —
worktree-gateinAGENTS.md/CLAUDE.md:always|never|ask. Unset ≡ask. - Recommend (ask / always) — suitability from project state (sibling
../scripts, full product pack, dirty primary tree). Good for code + unit tests; poor for pack without path rebinding. - Act by gate
never→ skip create;【工作区隔离跳过】escape=worktree-gate-never;reason=…always→ create when possible (no ask)ask→ after recommendation, ask: create / decline / lean; do not silently create
- Create — prefer the agent’s native workspace/worktree capability when available (avoids harness-invisible phantom git worktrees); else git fallback under ignored project-local dir (
.worktrees/preferred). Verify ignore withgit check-ignore. Path priority and failure fallback:reference.md. - Setup + baseline — in the new workspace, run project-appropriate install/build and a baseline test/typecheck when the project has one; if baseline fails, report and ask whether to proceed or investigate. Skip install/baseline only when no project markers apply.
- Lean/hotfix / decline —
【工作区隔离跳过】escape=lean-hotfix|user-decline;reason=…
Do not replace design approval. Do not silently destroy isolation mid-run. Do not imply one-click full product pack inside a worktree.
Cleanup ownership
Destroy/remove after verify/archive → feature-branch-closeout optional cleanup. This skill may note the remove command symmetric to create.
Integration guide
- Hosts: one line before the first artifact/code write — load this skill (worktree gate + optional isolation).
- Compose with
feature-branch-closeoutfor cleanup only. - Prefer
user-invocable: false. - Full detect/create/setup checklist:
reference.md.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

