git-clean-commit-guard

A pre-commit check for cleaning a repository's changes before a commit, a saved set of changes in version control.

In plain words
What is it for?
Use it to inspect changes, separate unrelated work, identify unsafe files, and prepare explicit files for staging.
Why use it?
It helps prevent unrelated files, secrets, generated output, and mixed work from being included accidentally.

Skill for Claude CodeCodex

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/orlando-japan/claude-code-setting/git-clean-commit-guard
Any agent
npx skills add orlando-japan/claude-code-setting --skill git-clean-commit-guard
Clone the repo
git clone --depth 1 https://github.com/orlando-japan/claude-code-setting

Made for: Claude Code, Codex.

Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 504 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.00043 $0.00504
Opus 5 $0.00022 $0.00252
Sonnet 5 $0.00009 $0.00101
Haiku 4.5 $0.00004 $0.00050

Measured 2d ago against content hash 469e056416f7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

git-clean-commit-guard 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 2d ago.

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.

templates/extra/skills/git-clean-commit-guard/SKILL.md · 72 lines

What it actually says

Git clean commit guard

A good commit starts before the message. This skill is the pre-commit hygiene pass: reduce staging noise, isolate one logical change, and catch the files that should never ride along.

What this skill does

It does not write the final commit message. It prepares the diff so a later commit or review step can succeed.

Guard workflow

  1. Inspect the repo state
    • git status
    • git diff
    • git diff --staged
  2. Split logical changes
    • If the diff mixes unrelated work, stop and split it before committing
  3. Remove accidental files
    • local config
    • generated artifacts
    • debug output
    • unrelated lockfile churn
    • credentials / secrets
  4. Check commit scope integrity
    • Bug fix + test together is fine
    • Feature + refactor + docs usually needs separation
  5. Propose explicit staging
    • Prefer file-by-file git add <path>
    • Avoid blanket staging commands

Things that should trigger a block

  • .env, credentials, tokens, keys, passwords
  • build output or generated snapshots with no clear reason
  • staged files unrelated to the stated task
  • opportunistic refactors bundled into a fix commit
  • a lockfile change without a matching dependency reason

Preferred output

Commit hygiene result: Pass | Pass with nits | Block

Keep staged:
- <paths>

Unstage / remove:
- <paths>

Reason:
- <scope contamination or safety risk>

Suggested next command set:
- git restore --staged ...
- git add ...

Anti-patterns

  • Starting with the commit message — first clean the diff, then name it.
  • Using git add . out of laziness — that is how local junk enters history.
  • Treating "mostly related" as good enough — future bisect and review quality collapse fast.
  • Letting secrets rely on luck — always perform an intentional safety scan.
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. 2d ago First seen · 72 lines · 43 tokens per session scan A 469e056416f7

Subscribe to this mod's changes

git-clean-commit-guard is a skill published in the GitHub repository orlando-japan/claude-code-setting (2 stars, last pushed 3mo ago), licensed MIT. It adds 43 tokens to every session and 504 once invoked, about $0.0002 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.