git-hygiene

git-hygiene is a skill for Claude Code from ArcBlock/agent-skills. It costs 91 tokens per session (4,511 once invoked), scanned A, original, MIT.

A Git cleanup procedure for after merges or parallel branch work. It returns the main checkout to the default branch, updates it, and removes only local worktrees and branches with no unique work left.

In plain words
What is it for?
Finishing merged work, checking whether branches are safely included in the remote default branch, pruning unused worktrees, and restoring the primary checkout.
Why use it?
It leaves the local repository orderly without deleting uncommitted changes or branches that still contain work.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the agentloop plugin — 24 skills shipped together

Good fit Finishing merged work, checking whether branches are safely included in the remote default branch, pruning unused worktrees, and restoring the primary checkout.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/arcblock/agent-skills/git-hygiene
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ArcBlock/agent-skills --skill git-hygiene
Clone the repo
git clone --depth 1 https://github.com/ArcBlock/agent-skills

Made for: Claude Code.

Or install agentloop, the plugin that ships this one along with the rest of its 24 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for git-hygiene

README.md
[![agentmods](https://agentmods.dev/badge/skills/arcblock/agent-skills/git-hygiene/github.svg)](https://agentmods.dev/skills/arcblock/agent-skills/git-hygiene)
Your own site
<a href="https://agentmods.dev/skills/arcblock/agent-skills/git-hygiene"><img src="https://agentmods.dev/badge/skills/arcblock/agent-skills/git-hygiene/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for git-hygiene

Your own site · 80×15
<a href="https://agentmods.dev/skills/arcblock/agent-skills/git-hygiene"><img src="https://agentmods.dev/badge/skills/arcblock/agent-skills/git-hygiene.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 91 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,511 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00091 $0.04511
Opus 5.5 $0.00036 $0.01804
Sonnet 5.5 $0.00018 $0.00902
Haiku 4.5 $0.00009 $0.00451

Measured 1mo ago against content hash d4c2cf3e2a4f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

git-hygiene scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/git-hygiene.sh, test/git-hygiene.test.ts), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/agentloop/skills/git-hygiene/SKILL.md · 295 lines

How it starts

The opening of the file, as written. The whole thing — 295 lines — stays where its author put it; the contents beside it link to each section on GitHub.

git-hygiene

收工 / 合并后的本地 Git 卫生:回默认分支 → 拉最新 → 只清确认无独特工作的 worktree 与本地分支。

与现有 skill 的分工:

Skill 做什么
git-hygiene(本 skill) 回 main、ff-only pull、按「相对 origin/main 是否还有独有提交」清 worktree/分支
git-worktree(compound-engineering) 创建 / 切换 / 交互式清理 .worktrees/ 约定 下的并行 worktree
blocklet-branch 按 blocklet 仓库约定开迭代分支

本 skill 不替你 merge PR、不 force-push、不 git clean -fdx、不丢 dirty 改动。

触发

  • 「切到 main / 拉最新 / 清理没用的 worktree 和 branch」
  • 「确认没有未合并工作再删」
  • PR 已 merge 后的本地收尾
  • 多 agent 并行结束后的主工作区复位
  • 「这些 KEEP 的分支是不是该补 PR / 帮我看看最新改动是什么时候 / 仔细核对没合入的话都发 PR」 → 触发 §4.5-4.7 深挖流程(默认 §3-6 主流程不做这一层,太贵;只在用户明确要求时才逐条调查)

默认假设

  • 远程名:origin
  • 默认分支:优先 origin/HEAD → 否则 main → 否则 master
  • 删除前提 = 内容已在 origin/<default> 上,不是「我记得 merge 了」

硬规则

  1. 主工作区 dirty → 停。 有 uncommitted 改动时不 checkout、不删分支。先让用户 commit / stash / 明确丢弃。
  2. 只 git pull --ff-only。 拒绝非快进;有分叉就报告,不 rebase/merge 擅自修。
  3. 不删仍有独有提交的分支。
    git merge-base --is-ancestor <branch> origin/<default> 为假 → KEEP,除非走 squash 校验(见下)。
  4. 不删 dirty / locked worktree。
  5. 不删当前检出分支(先切到 default)。
  6. 主 worktree 永不 worktree remove。
  7. 远程 origin/<branch> 已 gone ≠ 本地可删。 gone 只说明远端没了;本地 tip 仍可能有未合入提交。
  8. 一次审批只管这一次。 用户说「继续清」时仍对 KEEP 列表逐类处理,不默认 branch -D 全部 unmerged。

流程

0. 范围

  • 默认:当前 repo(git rev-parse --show-toplevel)
  • 用户点名多个 repo(如 site + arc):每个 repo 单独跑完整流程,报告分开写

优先跑确定性脚本(inventory;可选 apply)。脚本在 skill 旁:

# From agentloop plugin install (team):
ROOT="${AGENTLOOP_ROOT:-$HOME/.claude/plugins/marketplaces/arcblock-agent-skills/plugins/agentloop}"
# Or when developing in arc SoT:
# ROOT="$(git rev-parse --show-toplevel)/.claude/plugins/agentloop"

bash "$ROOT/skills/git-hygiene/scripts/git-hygiene.sh" inventory
# 审查报告后:
bash "$ROOT/skills/git-hygiene/scripts/git-hygiene.sh" apply --yes
# 多 repo:
bash "$ROOT/skills/git-hygiene/scripts/git-hygiene.sh" inventory /path/to/other-repo

Agent 必须读脚本输出再决策;apply 只处理 SAFE 类。SQUASH_CANDIDATE / KEEP 由 agent 按下面规则处理。

Read the full file on GitHub · 295 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · -1 lines d4c2cf3e2a4f
  2. 2mo ago Changed · -8 lines · -100 tokens per session caeee3b12b43
  3. 3mo ago First seen · 304 lines · 191 tokens per session scan A a65c4791b872

Subscribe to this mod's changes

git-hygiene is a skill published in the GitHub repository ArcBlock/agent-skills (5 stars, last pushed 22d ago), licensed MIT. It adds 91 tokens to every session and 4,511 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

git-hygiene compared with skills from other repositories

git-hygiene next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
git-hygieneArcBlock/agent-skillsSkill522d agoMITA91Claude Code
merge-batchdiegosouzapw/OmniRouteSkill91k3d agoMITA46Claude Code
prowler-commitprowler-cloud/prowlerSkill15ktodayApache-2.0A44Claude Code, Codex
gh-auth-isolationgithub/gh-awSkill5.8ktodayMITA20Claude Code, Codex
github-skillzeenie-ai/OpenCompanySkill1.1kyesterdayMITA51Claude Code
comet-githubrpamis/cometSkill3.3ktodayMITA72Claude Code, Codex
re0-mergeLilMGenius/paperthinSkill1.5ktodayMITA51Claude Code, Codex