agentleFS
ZilongRRRZilongRRR/claude-skill/git-discipline/SKILL.md

git-discipline

Skill0 starsChanged 4 months agoMITView on GitHub

When to commit, push, open a PR, or take any other irreversible outward-facing action — and when not to. Use before running git commit / git push / gh pr create / gh pr merge, before writing to a production database or running DDL, before setting secrets or triggering a deploy, and whenever finishing a piece of work and deciding what to do next. Covers "commit", "push it", "open a PR", 發 pr / 開 pr / 推上去 / 部署.

  • Commits and pushes

7 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions7 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 7

    1. Sapere-IA/sdd-onboarding-kit★ 18same name
    2. rainforest888/raincode★ 9same name
    3. annatchijova/SKILLS★ 8same name
    4. radif-ru/ai-multi-agent-system★ 6same name
    5. dekoza/oh-my-slop★ 4same name
    6. AL-JANEF/janef-forge★ 1same name
    7. Nadav011/apex-skills★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repositoryOne other file it gives its agents.

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When the work is done, the reply is:

    line 58
  2. Distinctive:

    One delivery, one PR: Do not split a batch of related work into one PR per commit unless asked.

    line 86
  3. Distinctive:

    If a PR for this work is already open, default to extending it rather than opening a second one.

    line 88
  4. Distinctive:

    Add a row every time this rule gets broken, with the date and the user's actual words.

    line 95

“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “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

Git discipline

The rule

Never git commit, git push, or open a PR unless the user explicitly asked for it — in this message or a still-standing earlier one.

Finishing the code is not permission to publish it.

This is not a style preference. Many people review work in a running dev environment before it becomes a commit; a pushed branch skips that review, and an opened PR pulls in other people.

The test

An instruction about the code is not an instruction about git.

That single confusion is where almost every violation comes from. "Fix the bug", "update the logic", "make it use the new API" are instructions to edit files. None of them says anything about publishing the result.

Kind of messagePermission to commit?
"commit this", "push it", "open a PR", 「發 pr」「開 pr」「推上去」✅ yes
"put it in the existing PR"✅ yes — and it names the target
"fix X", "update Y", "add Z", "refactor W"❌ no — about the code
"should we also do X?", "is this the right approach?"❌ no — a question
"that's all", "thanks", "done"❌ no — ends the task, does not ship it

Match on shape, not on literal strings. A user who has never used the word "commit" can still clearly authorise one; a user who says "just fix it quickly" has not.

A question is never permission. Answering a question does not authorise shipping the answer.

The sequence

1. write the code
2. typecheck + lint
3. run it locally, verify, capture the actual numbers
4. REPORT AND STOP        ← the step that gets skipped
5. user reviews and says go
6. commit → push → PR

Step 4 means stop. Not "ask and keep going". Not "commit first so it's ready when they say yes". After the report, the next move is the user's.

What to say instead of committing

When the work is done, the reply is:

  • which files changed, and what each change does
  • how it was verified, with real output — not "should work"
  • anything left out, uncertain, or done under an assumption
  • one question: open a PR?

That reply is the deliverable at that point. It is not a preamble to a commit.

The same gate covers these

Anything that leaves the machine or changes shared state needs the same explicit go-ahead:

  • writing to a production database, or running DDL against one
  • secrets: gh secret set, CI/CD variables, cloud provider config
  • triggering a deploy or a CI workflow
  • third-party APIs that mutate: CDN purges, DNS, analytics, search consoles, issue trackers, chat/email sends
  • merging, force-pushing, deleting branches or tags

Reading is fine. Measuring is fine. Writing is not.

Note the asymmetry: reverting a commit is easy, but you cannot un-notify the twelve people watching the repo, and you cannot un-send a deploy.

PR granularity

  • One delivery, one PR. Do not split a batch of related work into one PR per commit unless asked.
  • If a PR for this work is already open, default to extending it rather than opening a second one. Ask which if unclear.
  • Branch from a freshly fetched default branch (git fetch first), never from a stale local copy.

Keep a violation log

Add a row every time this rule gets broken, with the date and the user's actual words. Abstract rules get skimmed; dated concrete examples do not.

DateWhat the user saidWhat happenedShould have happened
(example)"fix these three and check"committed, pushed, opened a PRfixed them, verified locally, reported, stopped
(example)"so should we update the docs too?"updated docs, committed, pushedanswered the question, showed the diff, stopped

Both examples above are real. Neither caused damage — nothing was merged or deployed — but both skipped a review someone was relying on.

This skill cannot enforce itself

Skills auto-load by matching the user's request. The dangerous moment is the opposite: the user asks for a code change, never mentions git, and the decision to commit happens afterwards — when nothing in the request would have loaded this file.

So the real stop is guard.sh in this directory, wired as a PreToolUse hook on Bash. It fires on the tool call itself, so loading is irrelevant.

It returns permissionDecision: "ask", not "deny", deliberately: users do legitimately ask for commits, and denying makes those impossible. Asking makes every git write visible and impossible to do silently — which is the actual failure mode.

Intercepted: git commit|push|merge|rebase|reset --hard|tag, gh pr create|merge|edit|close|reopen, gh secret set|delete, gh workflow run, gh release create, gh api with a write method.

Passed through: git status|log|diff|show|fetch|add|checkout, gh pr view|list. Investigation must stay friction-free, or the hook gets disabled.

Installation and configuration: see README.md in this directory.

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.