Commit Skill
Turn a dirty worktree into the smallest honest set of commits. Plan the full set first. Stage exactly, validate intentionally, commit from a message file, refresh state, and repeat until every intended change is committed or explicitly left behind.
WORKING DIRECTORY: optional argument, default current directory.
Goals
- Create one logical unit per commit
- Keep early work out of later catch-all commits
- Stage exact files or hunks; use hunk-level staging for mixed files
- Use message-file commits every time
- Follow repo conventions before fallback conventions
- Commit changelog or release fragments with the code they describe
- End with a complete accounting of committed and remaining work
Required follow-up reads
| Need |
Read |
When |
| End-to-end commit execution |
references/workflow.md |
Before planning, grouping, messaging, validating, handling changelogs, splitting, or recovering |
| Precise Git staging/history |
references/git.md |
For patch-mode, partial new files, pathspecs, amend/fixup/reword, split-last-commit, or recovery |
| GitButler writes/history |
references/but.md |
For JSON mutations, hunk IDs, assignment-first flows, rewording, surgery, branch movement, or recovery |
| Changelog/release handling |
references/changelog.md |
When the repo may use changelogs, fragments, release automation, or issue-closing notes |
Engine selection
- Discover repo policy first. Read the smallest repo-local set that controls commits:
- nearest + root
AGENTS.md
CONTRIBUTING.md, README.md, release docs, issue-closing rules
- commit templates,
.gitmessage, commitlint*, hook config (.husky/, .lefthook/, .pre-commit-config.yaml, lint-staged)
- changelog/release systems:
CHANGELOG.md, .changeset/, newsfragments/, changelog.d/, release automation
- recent commit subjects when style is still unclear
Extract message format, trailers/signoff/DCO, required validation, changelog expectations, issue refs, and push policy.
- Use But mode when the repo is GitButler-managed and
but status --json is the natural write path
- Otherwise use Git mode
- In But mode, NEVER use raw
git add, git commit, git rebase, or equivalent write commands. Read-only Git inspection MAY be used
Safety checks
- NEVER commit before seeing the whole change set
- If nothing is staged, stage only the intended files/hunks unless the user explicitly said staged-only
- NEVER leave staged files/hunks unaccounted for. Every staged change MUST be committed now or intentionally left untouched because the user asked
- NEVER trust staging blindly; verify with cached diff or returned JSON state
- If split-plan dependencies become circular or unclear, stop and re-plan
- NEVER push unless the user explicitly asked for it
- If a repo has custom commit rules, follow them over the fallback format
- If the user asks for only part of the work to be committed, leave the rest untouched
Reference examples live in references/git.md and references/but.md; safety checks above are binding.
Return format
Return a compact plain-text report:
commits: created commits with SHA + subject, oldest -> newest
validation: commands run, skipped, or failed
changelog: updated files or none
remaining: clean worktree or remaining paths intentionally left uncommitted
For preview-only or dry-run:
- say
no commits created
- print the proposed commit message(s) and split order instead
Reference routing
Use the Required follow-up reads table near the top of this file; do not preload commit references before engine selection makes them relevant.
Optional arguments: $ARGUMENTS
1---2disable-model-invocation: true3name: commit4description: "Use when the user asks to create, split, stage, unstage, amend, or polish Git commits or history."5license: AGPL-3.0-or-later6metadata:7 author: anntnzrb89---1011# Commit Skill1213Turn a dirty worktree into the smallest honest set of commits. Plan the full set first. Stage exactly, validate intentionally, commit from a message file, refresh state, and repeat until every intended change is committed or explicitly left behind.1415WORKING DIRECTORY: optional argument, default current directory.1617## Goals1819- Create one logical unit per commit20- Keep early work out of later catch-all commits21- Stage exact files or hunks; use hunk-level staging for mixed files22- Use message-file commits every time23- Follow repo conventions before fallback conventions24- Commit changelog or release fragments with the code they describe25- End with a complete accounting of committed and remaining work2627## Required follow-up reads2829| Need | Read | When |30| --- | --- | --- |31| End-to-end commit execution | `references/workflow.md` | Before planning, grouping, messaging, validating, handling changelogs, splitting, or recovering |32| Precise Git staging/history | `references/git.md` | For patch-mode, partial new files, pathspecs, amend/fixup/reword, split-last-commit, or recovery |33| GitButler writes/history | `references/but.md` | For JSON mutations, hunk IDs, assignment-first flows, rewording, surgery, branch movement, or recovery |34| Changelog/release handling | `references/changelog.md` | When the repo may use changelogs, fragments, release automation, or issue-closing notes |3536## Engine selection37381. Discover repo policy first. Read the smallest repo-local set that controls commits:39 - nearest + root `AGENTS.md`40 - `CONTRIBUTING.md`, `README.md`, release docs, issue-closing rules41 - commit templates, `.gitmessage`, `commitlint*`, hook config (`.husky/`, `.lefthook/`, `.pre-commit-config.yaml`, `lint-staged`)42 - changelog/release systems: `CHANGELOG.md`, `.changeset/`, `newsfragments/`, `changelog.d/`, release automation43 - recent commit subjects when style is still unclear44 Extract message format, trailers/signoff/DCO, required validation, changelog expectations, issue refs, and push policy.452. Use **But mode** when the repo is GitButler-managed and `but status --json` is the natural write path463. Otherwise use **Git mode**474. In But mode, NEVER use raw `git add`, `git commit`, `git rebase`, or equivalent write commands. Read-only Git inspection MAY be used4849## Safety checks5051- NEVER commit before seeing the whole change set52- If nothing is staged, stage only the intended files/hunks unless the user explicitly said staged-only53- NEVER leave staged files/hunks unaccounted for. Every staged change MUST be committed now or intentionally left untouched because the user asked54- NEVER trust staging blindly; verify with cached diff or returned JSON state55- If split-plan dependencies become circular or unclear, stop and re-plan56- NEVER push unless the user explicitly asked for it57- If a repo has custom commit rules, follow them over the fallback format58- If the user asks for only part of the work to be committed, leave the rest untouched5960Reference examples live in `references/git.md` and `references/but.md`; safety checks above are binding.6162## Return format6364Return a compact plain-text report:6566- `commits:` created commits with SHA + subject, oldest -> newest67- `validation:` commands run, skipped, or failed68- `changelog:` updated files or `none`69- `remaining:` clean worktree or remaining paths intentionally left uncommitted7071For preview-only or dry-run:7273- say `no commits created`74- print the proposed commit message(s) and split order instead7576## Reference routing7778Use the Required follow-up reads table near the top of this file; do not preload commit references before engine selection makes them relevant.7980Optional arguments: $ARGUMENTS