Skip to main content

cleanup-complete-branches

Clean up completed Git branches and worktrees for this repository, both locally and on GitHub. Use when the user says "/cleanup-complete-branches", "$cleanup-complete-branches", "clean up complete branches", "remove merged branches", "delete completed worktrees", "prune old worktrees", or asks to remove local and remote branches after pull requests are merged or closed.

跳到安装

来源信息

仓库
jtenniswood/esphome-media-player
最近来源活动
2026年7月7日 09:04
检测到的 SKILL.md 语言
英语
星标
230
分支
35

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

文件资源管理器
3 个文件

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
cleanup-complete-branches
description
Clean up completed Git branches and worktrees for this repository, both locally and on GitHub. Use when the user says "/cleanup-complete-branches", "$cleanup-complete-branches", "clean up complete branches", "remove merged branches", "delete completed worktrees", "prune old worktrees", or asks to remove local and remote branches after pull requests are merged or closed.
# Cleanup Complete Branches Remove completed worktrees, local branches, and GitHub branches without touching active work. ## Workflow ### 1. Start With A Preview Always run the bundled script in dry-run mode first: ```bash python3 .agents/skills/cleanup-complete-branches/scripts/cleanup_complete_branches.py ``` Dry-run mode fetches and prunes remotes, then reports what would be removed. It must not delete anything. Review the output before applying changes. Treat these as blockers: - A worktree is dirty. - A branch has no merged GitHub PR and is not merged into `origin/main`. - The branch name is protected. - GitHub CLI authentication is missing and completion cannot be proven from git history alone. ### 2. Apply The Cleanup If the dry run only lists completed branches and clean worktrees, apply it: ```bash python3 .agents/skills/cleanup-complete-branches/scripts/cleanup_complete_branches.py --apply ``` The script removes clean completed worktrees first, then deletes matching local branches, then deletes matching `origin` branches on GitHub. ### 3. Optional Cases Only remove closed-but-unmerged PR branches when the user explicitly asks for branches from abandoned or closed PRs to be removed: ```bash python3 .agents/skills/cleanup-complete-branches/scripts/cleanup_complete_branches.py --apply --include-closed-unmerged ``` Use `--force-worktrees` only when the user explicitly accepts losing uncommitted files inside completed worktrees: ```bash python3 .agents/skills/cleanup-complete-branches/scripts/cleanup_complete_branches.py --apply --force-worktrees ``` ## Safety Rules - Never delete `main`, `master`, `develop`, `dev`, `release`, `staging`, or `production`. - Never delete the currently checked-out branch. - Never delete a dirty worktree unless the user explicitly requested force. - Prefer GitHub PR status for squashed PRs, because git ancestry may not show squashed branches as merged. - If a branch is ambiguous, report it and leave it alone. - Do not close GitHub issues or PRs as part of cleanup. ## Reporting Summarize: - Worktrees removed or skipped. - Local branches removed or skipped. - GitHub branches removed or skipped. - Any branches that need the user's decision.
在 GitHub 查看