AgentSkillsCN

worktree-cleanup

清除陈旧的 Git 工作树及其分支。

SKILL.md
--- frontmatter
name: worktree-cleanup
description: Remove stale git worktrees and their branches.
allowed-tools: Bash(git *)
model: haiku

/worktree-cleanup

List and clean up stale worktrees.

bash
git worktree list

For each worktree (except main):

  1. Check if branch is merged to main
  2. Check for uncommitted changes

Merged + clean → remove:

bash
git worktree remove ../worktree-<name>
git branch -d task/<name>

Unmerged or dirty → report and ask user.