Use when the user wants to audit local git worktrees against origin/x, choose by number or A, and decide whether stale worktree directories, already-merged worktrees, or no-delta worktrees can be cleaned up. Triggers on "worktree clean", "worktree 合并到 x", "检测哪些 worktree 已进 x".
68
84%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
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.
1, 2,4, or A.origin/x before running the check.x with matching HEAD and file content, content equality, and a whitespace-preserving patch-id match for squash merges. If these checks cannot prove the result, report NEEDS_MANUAL_REVIEW instead of guessing.gh when available; if auth or network is unavailable, report that explicitly and continue the local git-based check..worktree/ or .worktrees/ but are no longer registered by git worktree listMERGED_TO_ORIGIN_X_BY_*) or NO_BRANCH_CODE_DELTA_FROM_COMMON_BASE, are clean, and are neither the main worktree nor the current worktreeRun:
rtk proxy bash .skillshare/skills/1k-worktree-clean/scripts/1k-worktree-clean.sh listThen present the choices to the user and append:
请回复编号,例如 `1`、`2,4` 或 `A`。List output should include, for each worktree:
Run:
rtk git fetch origin xIf sandboxing blocks the fetch, request approval and rerun it.
Run one of:
rtk proxy bash .skillshare/skills/1k-worktree-clean/scripts/1k-worktree-clean.sh check 1
rtk proxy bash .skillshare/skills/1k-worktree-clean/scripts/1k-worktree-clean.sh check 1,3
rtk proxy bash .skillshare/skills/1k-worktree-clean/scripts/1k-worktree-clean.sh check ARun the matching cleanup-candidate command with the same selection:
rtk proxy bash .skillshare/skills/1k-worktree-clean/scripts/1k-worktree-clean.sh cleanup-candidates 1
rtk proxy bash .skillshare/skills/1k-worktree-clean/scripts/1k-worktree-clean.sh cleanup-candidates 1,3
rtk proxy bash .skillshare/skills/1k-worktree-clean/scripts/1k-worktree-clean.sh cleanup-candidates AThen summarize:
MERGED_TO_ORIGIN_X_BY_* result or NO_BRANCH_CODE_DELTA_FROM_COMMON_BASE)If there is at least one cleanup candidate, append:
如需继续清理,请回复:
`stale`:只删残留目录
`merged 2,4`:只删这些可移除且 clean 的 worktree
`all`:两类都清理
`no`:不清理If there are no cleanup candidates, say so explicitly.
If the user confirms cleanup:
rtk git worktree remove <path>rtk proxy rm -rf <path>MERGED_TO_ORIGIN_X_BY_ANCESTOR: the worktree HEAD is an ancestor of origin/x.MERGED_TO_ORIGIN_X_BY_PR: GitHub reports a merged PR from this branch into x, its headRefOid matches the current worktree HEAD, and the branch-side candidate blobs match origin/x.MERGED_TO_ORIGIN_X_BY_PATCH_ID: the branch's aggregate patch matches a non-merge commit on the first-parent history of origin/x, covering squash merges. This local check also runs for detached worktrees and when PR lookup is unavailable. If Git does not support whitespace-preserving --verbatim, skip patch-id inference and explicitly report the missing capability when local code checks cannot prove the result; never fall back to whitespace-insensitive matching.MERGED_TO_ORIGIN_X_BY_CODE: every branch-side candidate file now matches origin/x.NEEDS_MANUAL_REVIEW: later edits or conflict resolution prevent the script from proving equivalence.HEAD are reported as NEEDS_MANUAL_REVIEW and do not abort the full audit.NO_BRANCH_CODE_DELTA_FROM_COMMON_BASE: the worktree has no committed branch-only code delta relative to the common base with origin/x. If it is also clean and is neither the main worktree nor the current worktree, treat it as a removable cleanup candidate.Working tree: dirty: show the dirty files and state that current local edits still need separate review.已合并到远端 x(按代码内容判断).NO_BRANCH_CODE_DELTA_FROM_COMMON_BASE, explicitly say it has no committed branch delta relative to origin/x, and that it is removable when it is also clean and not the main/current worktree.356c24e
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.