Commit: Batch
Split uncommitted changes into granular commits.
SKILL.mdskills/commit-batch/SKILL.md
GitHubCurrent state
git status --short
git rev-parse --verify HEAD >/dev/null 2>&1 && git diff --stat HEAD || echo "(no commits yet, nothing to diff against)"
Steps
- The current state above was captured at invocation; run
git diff HEADon specific files only where the stat alone can't tell you what a change is. - Analyse the changes and group them into logical commit units; each group should represent a single coherent change (e.g. one feature, one fix, one refactor). If
$hintswas given, honour it as the intended grouping; it overrides the guidelines below where they conflict. - Present the proposed commit plan as a numbered list:
- Group name / files involved
- Suggested commit message (conventional commits format)
- Await approval: stop here and do not proceed until the user responds:
- If approved, execute commits sequentially. For each group:
- Stage only the files listed for that group (
git add <files>) - Commit with the proposed message
- If
git commitexits non-zero and stderr containscommit-msg:lines, read eachL<n> <rule>: <excerpt>line, rewrite the message to clear every hit (keeping the meaning) and retry the commit once. If the retry fails too, stop the batch and report the stderr verbatim along with which groups landed and which did not. Never pass--no-verifyand never change git config to get past the hook. - Confirm success before moving to the next group
- Stage only the files listed for that group (
- If changes requested, revise the plan and repeat from step 3.
- If approved, execute commits sequentially. For each group:
- Report the commits made and stop. Do not push. Publishing is a separate decision from committing; the user pushes, or asks for it explicitly.
Grouping Guidelines
- Prefer smaller, atomic commits over large ones
- Keep unrelated changes in separate commits even if they touch the same area
- Config/dependency changes separate from feature code
- Test changes alongside the code they test (same commit), unless the test is independent
- Generated files (lockfiles, build artefacts) get their own commit if significant