1k-worktree-clean
Installation
SKILL.md
Worktree Clean Check
Use this skill to list local worktrees, surface clean or dirty state, and judge whether selected committed branch code has already landed in origin/x by actual code content, not by merge commits alone.
Rules
- Always start by listing every local worktree with numeric choices.
- Ask the user to reply with
1,2,4, orA. - Always fetch the latest
origin/xbefore running the check. - Use commit graph data only to locate branch-side candidate files. Final judgment must come from content equality between the selected worktree snapshot and
origin/x. - Surface metadata that helps cleanup decisions: last commit time, upstream branch, PR status, and whether the worktree is nested under another linked worktree.
- PR status is best-effort only. Use
ghwhen available; if auth or network is unavailable, report that explicitly and continue the local git-based check. - If a worktree is dirty, report that separately and make it clear the committed-branch result does not cover uncommitted local edits.
- After the check result, always surface cleanup candidates:
- stale directories that exist under
.worktree/but are no longer registered bygit worktree list - selected worktrees that are
MERGED_TO_ORIGIN_X_BY_CODEorNO_BRANCH_CODE_DELTA_FROM_COMMON_BASE,clean, and are neither the main worktree nor the current worktree
- stale directories that exist under
- After surfacing cleanup candidates, always ask whether the user wants to remove stale directories, removable worktrees, both, or neither.
- Never auto-delete anything before the user explicitly confirms the cleanup action.