Best for
- Deciding whether a task should be isolated in a worktree at all
- Declaring which paths a worktree owns so parallel agents stay disjoint
- Answering "is this worktree merge-ready?" — status, dirty state,
event4u-app/agent-config/src/skills/worktree-lifecycle/SKILL.md
Use when governing a worktree across its whole life — scope-lock declaration, merge-readiness status, scoped verification, and safe cleanup that refuses while unique unmerged commits exist.
Decision brief
Governance layer for worktrees that already exist (or are about to). Creation mechanics — directory convention, ignore-safety, clean baseline — live in using-git-worktrees and are referenced, never restated here. This skill owns everything after the spawn: what the worktree is a…
Compatibility matrix
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/event4u-app/agent-config --skill "src/skills/worktree-lifecycle"Inspect the Agent Skill "worktree-lifecycle" from https://github.com/event4u-app/agent-config/blob/6a5670b7881a676c0da90d2afb950298087c4ccb/src/skills/worktree-lifecycle/SKILL.md at commit 6a5670b7881a676c0da90d2afb950298087c4ccb. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
Isolate when any holds; otherwise stay on the current branch (per the Do-NOT list in using-git-worktrees):
Deciding whether a task should be isolated in a worktree at all Declaring which paths a worktree owns so parallel agents stay disjoint Answering "is this worktree merge-ready?" — status, dirty state, ahead/behind, verification evidence Running the scoped verification for a workt…
Review the “The Iron Law” section in the pinned source before continuing.
Isolate when any holds; otherwise stay on the current branch (per the Do-NOT list in using-git-worktrees):
At worktree start, write a .worktree-scope.md note at the worktree root and keep it untracked via .git/info/exclude (shared exclude — one line .worktree-scope.md, no commit needed):
Permission review
The documentation asks the agent to run terminal commands or scripts.
git diff --name-only "$(git merge-base HEAD <base>)"..HEADThe documentation asks the agent to run terminal commands or scripts.
npx tsx node_modules/@event4u/agent-config/src/scripts/worktree_cleanup_check.ts check <worktree-path>Evidence record
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 94/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 9 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Governance layer for worktrees that already exist (or are about to).
Creation mechanics — directory convention, ignore-safety, clean
baseline — live in using-git-worktrees
and are referenced, never restated here. This skill owns everything
after the spawn: what the worktree is allowed to touch, when it is
merge-ready, and when it may be removed.
Do NOT use when:
using-git-worktrees
(Iron Law: no worktree without verified ignore + clean baseline)git-workflowsubagent-orchestration
selects the mode; this skill governs the worktrees a chosen mode usesEVERY GOVERNED WORKTREE DECLARES ITS SCOPE. NO REMOVAL WHILE
UNIQUE UNMERGED COMMITS EXIST. INHERITED COMMITS ARE NEVER DROPPED.
Isolate when any holds; otherwise stay on the current branch
(per the Do-NOT list in using-git-worktrees):
Then create via using-git-worktrees
(or the host primitive — § Host-native mapping below), declare the
scope lock (§ 2), keep status honest (§ 3), and gate removal (§ 4).
At worktree start, write a .worktree-scope.md note at the worktree
root and keep it untracked via .git/info/exclude (shared exclude —
one line .worktree-scope.md, no commit needed):
## Scope lock
- branch: <branch-name>
- owns: <path or glob list — the ONLY paths this worktree edits>
- task: <one-line task statement>
- created: <ISO date>
The lock is the disjointness contract between parallel worktrees. A
diff that leaves the owned paths is scope creep — stop and surface,
per scope-control. Check mechanically:
git diff --name-only "$(git merge-base HEAD <base>)"..HEAD
# every path must match an `owns:` entry
A worktree is merge-ready only when ALL hold:
git status --porcelain is empty.owns: paths (command above).verify-before-complete);
record command + result tail in the status report. No fresh
evidence → not merge-ready, regardless of how the diff looks.git fetch origin --quiet then
git rev-list --left-right --count HEAD...origin/<base>. Behind →
flag; divergent (both sides non-zero on a pushed branch) → route to
git-workflow § Divergent-State Recovery.git-history-discipline,
shared-branch Iron Law).Removal is gated by the deterministic helper (edge-case-tested: detached HEAD, branch without remote, tag-only reachability, deleted remote branch, untracked files, paths with spaces):
npx tsx node_modules/@event4u/agent-config/src/scripts/worktree_cleanup_check.ts check <worktree-path>
Exit 0 → removal allowed; exit 1 → refuse, gates in order:
git status --porcelain non-empty, untracked
files included (never answer with --force).git-history-discipline).Then: remove, never delete — git worktree remove <path>, then
git worktree prune. Branch deletion is a separate, permission-gated
step (scope-control); never force-delete (-D) as part of cleanup.
Cross-worktree scope-lock overlaps are scanned via
worktree_cleanup_check scope-overlap (surfaced by /worktree status).
Whole-checkout sweeps. Worktrees accumulate one per branch and are never
removed on merge; git worktree prune only clears registrations whose
directory is already gone, so it does nothing for the live ones. Classify the
whole set in one pass rather than gate-checking by hand:
npx tsx node_modules/@event4u/agent-config/src/scripts/worktree_cleanup_check.ts inventory [repo] [--json|--plan]
safe requires all of: on a branch, merged into the trunk, clean, inside a
conventional worktree root (.claude/worktrees/ or .worktrees/), and no git
activity for 48 h. review keeps its disqualifying reason so the next sweep
starts from a shorter list; live means another session may hold it. A
worktree outside the conventional roots is never safe — sitting beside the
repo it can be mistaken for a sibling package, so its removal stays a
judgement call.
The mode reports only. --plan prints git worktree remove plus
git branch -d (never -D) for the safe set; running it is a bulk deletion
needing the user's explicit this-turn approval
(non-destructive-by-default), which a single earlier approval never covers.
| Host capability | Use |
|---|---|
Claude Code EnterWorktree / ExitWorktree | Enter/leave a governed worktree in-session; scope lock is written right after enter |
Claude Code subagent isolation: "worktree" | Dispatch a slice into its own auto-managed worktree; unchanged worktrees are auto-cleaned by the host — the unique-commit gate still applies to any it leaves behind |
| No worktree primitive (other hosts) | Degrade to plain git worktree add per using-git-worktrees § Procedure — same scope lock, same gates |
The mapping changes only who creates the directory. Scope lock, merge-ready checklist, and cleanup gates are host-independent.
git log <branch> --not --all is always empty — --all includes
the branch itself, so the naive check never fires. The
--exclude="refs/heads/<branch>" --all variant is also unreliable
when combined with --not (observed on git 2.39). Use the
for-each-ref expansion above — it enumerates every ref except the
branch explicitly..worktree-scope.md must be
in .git/info/exclude; .gitignore would be a tracked change
outside the scope lock.git fetch before the
rev-list --left-right count; a cached view reports merge-ready on
a diverged branch.owns: listgit worktree remove --force past a dirty treegit-history-discipline)owns: paths without surfacing it| Task | Skill / command |
|---|---|
| Creating the worktree (ignore-safety, baseline) | using-git-worktrees |
| Divergence recovery, safe squash, PR flow | git-workflow |
| Finishing the branch | finishing-a-development-branch |
| Day-to-day operations | /worktree create · status · verify · cleanup |
Frequently asked questions
Governance layer for worktrees that already exist (or are about to). Creation mechanics — directory convention, ignore-safety, clean baseline — live in using-git-worktrees and are referenced, never restated here. This skill owns everything after the spawn: what the worktree is a…
The source record exposes this install command: npx skills add https://github.com/event4u-app/agent-config --skill "src/skills/worktree-lifecycle". Inspect the command and pinned source before running it.
Static rules flagged exec-script in the source; the page lists the matching lines and excerpts.
Alternatives
coreyhaines31/marketingskills
When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "should I test this," "which version is better," "test two versions," "statistical significance," "how long should I run this test," "growth experiments," "experiment velocity," "experiment backlog," "ICE score," "experimentation program
garrytan/gbrain
End-to-end discipline for turning any large data source (audio libraries, email takeouts, document corpora, chat exports, API dumps) into brain pages at scale. The lifecycle spine: SCHEMA → ACCESS → TRIAL → EVALUATE → IMPROVE → CODIFY → TEST → SKILLIFY → BULK → MONITOR. State is tracked in a durable JSON manifest (see MANIFEST-PATTERN.md) so any crash, session boundary, or subagent fan-out resumes from ground truth instead of memory.
alirezarezvani/claude-skills
App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist
dotnet/skills
Migrates .NET test projects from VSTest to Microsoft.Testing.Platform (MTP). Use when user asks to "migrate to MTP", "switch from VSTest", "enable Microsoft.Testing.Platform", "use MTP runner", set OutputType=Exe only for test projects in Directory.Build.props, or mentions EnableMSTestRunner, EnableNUnitRunner, or UseMicrosoftTestingPlatformRunner. USE FOR: MTP behavioral differences vs VSTest (exit code 8, zero tests discovered, --ignore-exit-code, TESTINGPLATFORM_EXITCODE_IGNORE); centralizing