AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Branch Cleaner

skill-yuaicode-ai-skills-branch-cleaner · by YuAICode

列出可清理的本地分支(已合并 / 陈旧),供用户确认后再删。当用户说"清理分支 / 哪些分支可以删 / 列出过期分支 / 整理 git 分支 / 哪些分支可以清掉"时触发。

No reviews yet
0 installs
30 views
0.0% view→install

Install

$ agentstack add skill-yuaicode-ai-skills-branch-cleaner

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-yuaicode-ai-skills-branch-cleaner)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
3mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Branch Cleaner? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

branch-cleaner — 本地分支清理候选列表

扫描本地 git 分支,找出已合并进默认分支或长期无提交的"可清理"候选,展示给用户确认后再执行删除——脚本本身只读,绝不删分支。

何时触发

用户说"清理分支 / 哪些分支可以删 / 列出过期分支 / 整理 git 分支 / 哪些分支可以清掉"。

用法

1. 列出候选分支(确定性脚本)

bash /bin/list-branches.sh [额外保护分支...] [陈旧天数]
# 缺省:保护 main master + 当前分支,陈旧判定 60 天
# 例:bash /bin/list-branches.sh develop release 30

输出两组:

  • MERGED: — 已合并进默认分支(main/master)的本地分支,带最后提交日期。
  • STALE: — 最后提交早于 N 天的本地分支,带最后提交日期。

保护分支(绝不出现在候选列表): main / master / 当前所在分支 / 用户传入的额外保护分支。

2. Claude 展示候选并征得用户同意

  • 把两组候选逐条/批量展示给用户。
  • 必须明确得到用户同意后才执行删除,不能假设用户自动同意。
  • 对每个候选分支说明它为何可删(已合并 / 陈旧多少天)。

3. 用户确认后执行删除

# 已合并分支(安全删):
git branch -d 

# 陈旧但未合并的分支(需强删,执行前额外确认一次):
git branch -D 
  • MERGED 组的分支用 git branch -d(git 会再次验证已合并)。
  • 仅出现在 STALE 组、未出现在 MERGED 组的分支属于"未合并但陈旧",强删 (-D) 前须向用户再次显式确认,说明该分支未合并进默认分支。

4. 删后确认

跑一次 git branch 让用户确认分支已消失。

硬规则

  • 脚本只读:只用 git branch --mergedgit for-each-refgit branch(列表)等只读命令,绝不执行任何删除。
  • 保护分支与当前分支绝不动:无论用户怎么说,mainmaster、当前所在分支 永远不出现在候选列表里。
  • 删前确认:MERGED 组每次删前确认;STALE 未合并组须额外再次确认,并说明风险。
  • 不联网、不改任何远程资源:只操作本地分支。

边界

  • 只扫本地分支,不扫远程分支(remote-tracking refs)。
  • STALE 判定基于 committerdate(最后提交时间),与远程推送时间无关。
  • 若仓库没有 main 也没有 master,MERGED: 组可能为空(输出会注明)。
  • 不打 tag、不推送、不改配置。

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.