Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Worktree Lifecycle?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/wsauret-worktree-lifecycle)
---
description: Use when creating or adopting a Git worktree.
related: ship
---
# Worktree Lifecycle
A worktree is temporary isolation, not disposable work. Preserve ownership, destination, and every diff until integration is proved.
## Input and ownership
Start with create or adopt action, canonical path, branch or base, intended destination, integration method, and owner. Record these before mutation. Require Bash and Git before mutation, use a stable sibling path, and never overwrite existing work or place a worktree in disposable session storage.
A check-only worktree is detached at one commit and exists only to run gates, for example when the shared checkout cannot build. You may copy uncommitted files into it. It holds no work of its own, so its creator removes it before handoff.
## Method
1. Create or adopt the worktree and keep its ownership record current. Create a new worktree from a freshly fetched destination tip. In a new worktree, install dependencies from the lockfile before the first gate. Post the full absolute path of the worktree to the user as soon as it exists, so that they can open it in a file manager and inspect its files and diffs.
2. Keep work durable through commits or an explicit handoff before the owner exits.
3. After a rebase with conflicts, compare the old and new commits with `git range-diff` and confirm that each change from the destination side in the conflicted files survives.
4. Before final verification, fetch the destination and rebase onto its tip. When the base changed, run the gates again, because verification on the old base does not cover the rebased tree.
{{if:persona:ship&type:general}}
5. When publication is required, dispatch `ship` once without forked history in the existing worktree. Send the files to publish and a short summary of user intent and implemented design. Add a destination only when it differs from the normal push target. Keep integration and cleanup ownership in the parent, consume Ship's publication evidence, then resume destination integration and cleanup. When the parent's integration advances the remote destination, bring that branch's local checkout to the new tip with `git merge --ff-only`; when Git refuses, leave that checkout untouched.
{{end}}
{{if:persona:ship&!type:general}}
5. When publication is required, dispatch `ship` once in the existing worktree. Send the files to publish and a short summary of user intent and implemented design. Add a destination only when it differs from the normal push target. Keep integration and cleanup ownership in the parent, consume Ship's publication evidence, then resume destination integration and cleanup. When the parent's integration advances the remote destination, bring that branch's local checkout to the new tip with `git merge --ff-only`; when Git refuses, leave that checkout untouched.
{{end}}
{{if:!persona:ship}}
5. When publication is required, publish the selected files yourself from the existing worktree: commit them whole and push the branch to the destination, adding a destination only when it differs from the normal push target. Keep the commit and the pushed remote ref as publication evidence, then resume destination integration and cleanup. When the parent's integration advances the remote destination, bring that branch's local checkout to the new tip with `git merge --ff-only`; when Git refuses, leave that checkout untouched.
{{end}}
6. Consume fresh verification evidence. Run only lifecycle-specific clean-state and destination-containment proofs here.
7. Prove ancestry where applicable with `git merge-base --is-ancestor <commit> <destination>`.
8. Remove only the owned worktree after integration proof and a clean safety check, using `git worktree remove <path>` without force. A check-only worktree is integrated when every path that `git status --porcelain` lists in it is byte-identical to the published commit or to the shared checkout; remove that worktree only with `git worktree remove --force <path>`.
## Stop and result
Remove every worktree you created before you hand off or report. Never pass one to a parent or the person. Keep a worktree only when it holds unpublished work, and then state in the report why it stays. Report the full absolute path, branch, owner, destination, publication or handoff state, integration proof, cleanup state, and remaining action.
## Failure and recovery
Missing Bash or Git blocks before mutation. Any uncommitted work, uncertain owner, publication failure, or missing integration proof preserves the worktree and branch. Never reset, stash, clean, or use checkout-based recovery, and never force removal of a worktree other than an integrated check-only one. After restart, rediscover the path, branch, and commit, then resume the first incomplete lifecycle step.