active/dev.worktrees/SKILL.md
Create, inspect, remove, or transactionally clean landed Git worktrees.
npx skillsauth add kevinslin/skills dev.worktreesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Create and manage Git worktrees under ~/.worktrees. Use cleanup-landed only
after a caller has independently proved that the work landed and may be
discarded.
.git), unless the user provides an override.~/.worktrees/<repo>/<branch-name>./, it naturally becomes nested folders.mkdir -p ~/.worktrees/<repo>
git worktree add ~/.worktrees/<repo>/<branch-name> <branch-name>
mkdir -p ~/.worktrees/<repo>
git worktree add -b <branch-name> ~/.worktrees/<repo>/<branch-name> [start-point]
git worktree list --porcelain
Use ordinary removal only when the worktree is already clean and unlocked. Inspect tracked and untracked state immediately before removal. If it is dirty, stop and preserve it; do not force removal or infer that its contents landed.
git -C <worktree> status --short
git -C <repo> worktree remove <absolute-worktree-path>
Delete the local branch only when the caller separately established that it is no longer needed:
git -C <repo> branch -d -- <branch-name>
cleanup-landedUse ./scripts/cleanup_worktree.py to remove one exact worktree and its local
branch after the caller has proved the change landed. This path is destructive:
it resets tracked changes and deletes untracked and ignored files before
removing the worktree.
Before invoking it, record:
--no-worktree for a branch checked out nowhere;merge, squash, or rebase.Run a dry run first and require JSON status ready or noop:
python3 ./scripts/cleanup_worktree.py \
--repo <retained-checkout> \
--worktree <absolute-worktree-path> \
--expected-branch <branch> \
--expected-head <full-object-id> \
--base-ref <refreshed-local-base-branch> \
--landed-commit <full-landed-object-id> \
--merge-mode <merge|squash|rebase>
Rerun the exact command with --execute. Require final JSON status
complete or noop, with the path, registration, and local branch absent and
the base still containing the landed commit.
--expected-branch <branch> with --detached for a detached target.--worktree <path> with --no-worktree for branch-only cleanup; detached cleanup is invalid in that mode.blocked, partial, a nonzero exit, identity drift, or failed postconditions as a cleanup blocker.The script serializes each target, revalidates identity under the lock, and
journals new transactions under the Git common directory's
worktree-cleanup/ directory. It resumes matching legacy fin-cleanup/
journals in place. It never refreshes the base, proves external finalization,
runs repository hooks, prunes unrelated registrations, or mutates remote
branches; callers own those policies.
Prune only when the user explicitly requests repository-wide stale metadata cleanup. Preview first and do not use pruning as a substitute for targeted removal or journal recovery.
git -C <repo> worktree prune --dry-run
git -C <repo> worktree prune
codex-clean-worktrees; cleanup-landed owns one exact, proof-locked transaction.development
Create, rename, audit, or close a tracked Codex task whose turns and status are persisted in the local thread ledger. Only use when directly invoked.
testing
Manage Git preflight, branch and worktree creation, and completed-work cleanup. Use when explicitly invoked.
databases
Automatically use for durable knowledge, configured project-context lookup, and schema-backed artifact layouts.
content-media
Create, update, or optimize skills and SKILL.md content.