git-hygiene

git-hygiene is a skill for Claude Code, Codex from ArcBlock/agent-skills. It costs 191 tokens per session (4,645 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 CodeCodex

Part of the agentloop plugin — 18 skills shipped together

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.

agentmods
npx agentmods add skills/arcblock/agent-skills/git-hygiene
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, Codex.

Or install agentloop, the plugin that ships this one along with the rest of its 18 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.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.svg" alt="Measured on agentmods" height="20"></a>
Per session 191 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,645 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00191 $0.04645
Opus 5 $0.00096 $0.02322
Sonnet 5 $0.00038 $0.00929
Haiku 4.5 $0.00019 $0.00464

Measured 3d ago against content hash a65c4791b872, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 3d 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 · 304 lines

How it starts

The opening of the file, as written. The whole thing — 304 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 · 304 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. 3d 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 3d ago), licensed MIT. It adds 191 tokens to every session and 4,645 once invoked, about $0.0010 per session on Opus 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

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens

chat-perf

Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.

microsoft/vscode · 51 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens