agentleFS
Evan-DaruwallaEvan-Daruwalla/claude-skill-suite/commit-gate/SKILL.md

commit-gate

Skill0 starsChanged 45 days agoMITView on GitHub

Blocks commits that stage a secret: a git pre-commit hook plus a PreToolUse hook for model commits; also splits big changes into atomic commits. Use when: "guard my commits", "block secret commits", "set up the pre-commit hook".

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    PreToolUse: add to ~/.claude/settings.json hooks.PreToolUse (append, don't overwrite) an entry with "matcher": "Bash" running node …

    line 26
  2. Distinctive:

    When asked to commit a large change: propose a split into atomic commits (one logical change each), and write outcome-first messages …

    line 45

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

commit-gate — the secret never reaches a commit

Two hooks, one scanner (../history-leak-scan/pm-secretscan.js --staged):

HookFileFires whenEffect
git pre-commithooks/pre-commityou commit from the shellexit 1 → git aborts the commit
PreToolUse (matcher Bash|PowerShell)hooks/pretooluse-commit-gate.jsthe model runs git commit via BashpermissionDecision:"deny" → the tool call is blocked

Both fail OPEN on scanner error (never wedge commits) — but NOISILY: each prints/surfaces a "gate SKIPPED (fail-open), commit is UNSCANNED" warning, because a gate that skips silently is a dead gate. Both point a real hit at secret-rotation + the secrets-inventory.

Install

  • PreToolUse: add to ~/.claude/settings.json hooks.PreToolUse (append, don't overwrite) an entry with "matcher": "Bash" running node "<abs>/skills/commit-gate/hooks/pretooluse-commit-gate.js".
  • git pre-commit, per repo: cp hooks/pre-commit <repo>/.git/hooks/pre-commit (already executable via sh). Or set git config core.hooksPath globally to a dir holding it. Install into every repo that can hold a live credential first.
  • The pre-commit script references the scanner by an absolute path — set the SCANNER variable at the top of hooks/pre-commit to wherever you cloned this suite. The PreToolUse hook resolves the scanner relative to itself.

Verify before trusting (definition of done)

  1. node ../history-leak-scan/pm-secretscan.js --canary prints PASS.
  2. In a scratch repo with the pre-commit hook installed: staging a real-format secret and committing is BLOCKED; committing a placeholder-only change PASSES.
  3. Feed the PreToolUse hook a git commit stdin payload whose cwd has a staged secret → it returns permissionDecision:"deny"; a clean cwd → allow.

Atomic-commit / message layer (the judgment part)

When asked to commit a large change: propose a split into atomic commits (one logical change each), and write outcome-first messages (imperative subject, body explaining WHY). This half is model judgment; the gate above is the deterministic guarantee.

node hooks/pretooluse-commit-gate.js --canary — MUST print CANARY PASS 51/51 before you trust a result.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.