commit-batching
Skill82 starsChanged 42 days agoMITView on GitHub
Batch a dirty working tree into logical, single-concern commits instead of one monolithic `git add -A`. Use whenever you are about to commit and more than one file or concern has changed — survey every change, group by concern, stage each group by explicit path, write a focused message per commit, then push only if authorized.
- Reads credentials
In this repository27 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- ai-reviewSkill
- brieflySkill
- commit-batchSkill
- create-alertSkill
- disclose-projectSkill
- discloseSkill
- evolve-claude-mdSkill
- figure-reviewSkill
- grillingSkill
- grill-meSkill
- handoffSkill
- lit-reviewSkill
- overbakedSkill
- pathfinderSkill
- pickupSkill
- recover-sessionsSkill
- repo-initSkill
- retroSkill
- reviewer-2Skill
- slack-messageSkill
- spot-aiSkill
- tab-setupSkill
- unstaleSkill
- worklogSkill
- write-new-skillSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 34
Order for coherence: Put prerequisites (a helper, a rename, a refactor) before the change that consumes them, so each commit stands on its …
- Very specific: line 41
Before staging, scan for things that must not be committed — secrets, .env/credentials, large artifacts, scratch/temp output, editor cruft.
- Distinctive: line 42
When one file mixes two concerns, commit it with the group it most belongs to and note the rider in the message.
- Very specific: line 43
Use a plain quoted -m string (heredoc commit messages fail here).
≈ “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.
Files
You are about to commit. Do not git add -A && git commit the whole tree at once. Group the pending changes into logical, single-concern commits first.
Current working tree
git status --short 2>/dev/null || echo "(not a git repo)"
echo "--- branch ---"; git rev-parse --abbrev-ref HEAD 2>/dev/null || true
echo "--- staged/unstaged stat ---"; git diff --stat HEAD 2>/dev/null || true
echo "--- untracked ---"; git ls-files --others --exclude-standard 2>/dev/null || trueMethod
- Survey — run
git status(staged, unstaged, and untracked) and read enough ofgit diffto understand each change's intent. Never stage what you haven't looked at. - Plan — group changed paths into single-concern batches and draft a one-line message for each. Present the plan as a compact list before executing.
- Execute per group —
git add <explicit paths>→ confirmgit diff --cached --statmatches the intended group → commit with a focused message. Repeat for the next group. - Verify tree — after the loop,
git statusshould be clean (or leave only paths you deliberately chose not to commit). - Push — only if the original request asked you to push. Respect the repo's branching convention (branch first unless the project says commit straight to main).
Grouping principles
- One concern per commit. A feature, a bugfix, a refactor, and a config/dependency bump are separate commits even when touched in the same working session.
- Documentation folds in. A README or doc update that documents a specific batch belongs inside that batch's commit, not a standalone "update docs" commit. If one doc file's edits span several batches and can't be cleanly split, fold the whole doc change into the last batch you commit.
- Generated/mechanical changes (lockfiles, formatting sweeps, generated tables) go either with the change that caused them or in their own clearly-labeled commit — never silently folded into a feature commit.
- Order for coherence. Put prerequisites (a helper, a rename, a refactor) before the change that consumes them, so each commit stands on its own.
- Don't over-split. One logical change spread across N files is one commit, not N.
Staging safety
- Stage by explicit path for every group — never
git add -A/git add .; they sweep in scratch files, secrets, and unrelated edits. - Account for every path in
git status; include untracked files only when they belong to the group. - Before staging, scan for things that must not be committed — secrets,
.env/credentials, large artifacts, scratch/temp output, editor cruft. Stop and flag rather than commit them. - When one file mixes two concerns, commit it with the group it most belongs to and note the rider in the message. Interactive
git add -pis unavailable in this environment; for a true hunk split, construct a patch andgit apply --cached, or state the limitation. - Use a plain quoted
-mstring (heredoc commit messages fail here); include any trailer the repo/harness requires (e.g.Co-Authored-By).
Anti-Rationalization
| Excuse | Reality |
| "It's all one change — one commit is fine." | If the diff spans more than one concern (code + docs + config + refactor), it isn't one change. Split by concern. |
"git add -A is faster." | It also stages secrets, scratch files, and unrelated edits into one blob. Stage explicit paths. |
| "I'll squash/fixup it later." | Squash merges commits; it cannot split a monolithic one without manual surgery. Get the boundaries right up front. |
| "Only one file changed — skip the survey." | Batching is then trivially one commit, but still survey for untracked files and secrets before staging. |
| "The user is in a hurry — skip the plan." | The plan is a 3-line list; an entangled commit costs far more to untangle in review or revert. |
Verification
- Surveyed all changes (staged, unstaged, untracked) with
git status+git diffbefore staging. - Every commit staged explicit paths — no
git add -A/git add .. - No secrets, env files, credentials, or scratch artifacts staged (checked each group).
- Each commit message names one concern;
git diff --cached --statmatched the group before committing. git statusclean, or only intentionally-unstaged paths remain, after the loop.- Pushed only if the request authorized it; branching convention respected.
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
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.

