worktree-lifecycle

Guides git worktree lifecycle stages with decision trees, inspection steps, and cleanup checklists.

1|Updated Mar 18, 2026
One-click install
npx skills add https://github.com/psw7205/skills --skill worktree-lifecycle-psw7205
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: worktree-lifecycle
Source: https://github.com/psw7205/skills/tree/main/skills/worktree-lifecycle
Command: npx skills add https://github.com/psw7205/skills --skill worktree-lifecycle-psw7205

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Git worktree workflows fail most often at lifecycle boundaries: creating worktrees for trivial changes, splitting commits across branches, losing work by removing worktrees before squash merges land, or polluting shared databases. This Skill identifies which lifecycle stage you are in and provides the exact inspection steps, decision trees, and checklists for that stage. ## Core Features & Use Cases - Stage Identification: Classifies the current state into setup, working, prep, or cleanup by inspecting git status, worktree list, and repo policy docs instead of asking the user. - Fast-Path Decision Tree: Determines whether a change qualifies for a single-commit fast-path on the integration branch or requires a full worktree, based on change type (schema, dependency, cross-package) rather than size intuition. - Safe Cleanup Ordering: Enforces squash-verification via commit-hash ancestor checks before worktree removal, logical DB drop, and branch deletion to prevent work loss. - Use Case: Before merging a feature, ask whether the worktree can be removed; the Skill verifies the squash commit landed on the integration branch, then walks through worktree removal, DB drop, and branch deletion in the correct order. ## Quick Start Ask the assistant to decide whether a new task needs a worktree or can be done as a fast-path commit, or to verify it is safe to clean up a finished worktree.

Frequently Asked Questions about worktree-lifecycle

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I decide whether to use a git worktree or commit directly?▼

Use the fast-path only when the working tree is clean, the change closes in a single logical commit, and there are no schema, dependency, or cross-package changes. If any condition breaks, switch to a worktree rather than splitting commits across branches.

How do I safely remove a git worktree after merging?▼

First verify the squash commit landed on the integration branch using git merge-base --is-ancestor with the commit hash. Only then remove the worktree, drop the logical database, and delete the merged branch, in that order.

Why did my work disappear after removing a git worktree?▼

Work is lost when worktree removal or branch deletion happens before the squash commit is reflected on the integration branch. Always confirm the merge with a hash-based ancestor check, not just a commit message grep, before cleanup.

Should database migrations be created inside a git worktree?▼

It depends entirely on the repo's policy, which varies between projects. Some repos commit migrations from the worktree alongside schema changes; others generate them only in the root checkout. Read the repo's db package documentation before deciding.

What should be committed before a squash merge in a worktree workflow?▼

Route out-of-scope findings to a followups document as entries and move the completed plan document to its archive path, committing both on the worktree branch. Deferring these to post-squash commits splits the plan lifecycle across the integration branch history.