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---2name: commit3description: Use when the user asks to create, split, stage, unstage, amend, or polish Git commits or history.4license: AGPL-3.0-or-later5---67# Commit Skill89Turn 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.1011WORKING DIRECTORY: optional argument, default current directory.1213## Goals1415- Create one logical unit per commit16- Keep early work out of later catch-all commits17- Stage exact files or hunks; use hunk-level staging for mixed files18- Use message-file commits every time19- Follow repo conventions before fallback conventions20- Commit changelog or release fragments with the code they describe21- End with a complete accounting of committed and remaining work2223## Required follow-up reads2425| Need | Read | When |26| --- | --- | --- |27| End-to-end commit execution | `references/workflow.md` | Before planning, grouping, messaging, validating, handling changelogs, splitting, or recovering |28| Precise Git staging/history | `references/git.md` | For patch-mode, partial new files, pathspecs, amend/fixup/reword, split-last-commit, or recovery |29| GitButler writes/history | `references/but.md` | For JSON mutations, hunk IDs, assignment-first flows, rewording, surgery, branch movement, or recovery |30| Changelog/release handling | `references/changelog.md` | When the repo may use changelogs, fragments, release automation, or issue-closing notes |3132## Engine selection33341. Discover repo policy first. Read the smallest repo-local set that controls commits:35 - nearest + root `AGENTS.md`36 - `CONTRIBUTING.md`, `README.md`, release docs, issue-closing rules37 - commit templates, `.gitmessage`, `commitlint*`, hook config (`.husky/`, `.lefthook/`, `.pre-commit-config.yaml`, `lint-staged`)38 - changelog/release systems: `CHANGELOG.md`, `.changeset/`, `newsfragments/`, `changelog.d/`, release automation39 - recent commit subjects when style is still unclear40 Extract message format, trailers/signoff/DCO, required validation, changelog expectations, issue refs, and push policy.412. Use **But mode** when the repo is GitButler-managed and `but status --json` is the natural write path423. Otherwise use **Git mode**434. In But mode, NEVER use raw `git add`, `git commit`, `git rebase`, or equivalent write commands. Read-only Git inspection MAY be used4445## Safety checks4647- NEVER commit before seeing the whole change set48- If nothing is staged, stage only the intended files/hunks unless the user explicitly said staged-only49- NEVER leave staged files/hunks unaccounted for. Every staged change MUST be committed now or intentionally left untouched because the user asked50- NEVER trust staging blindly; verify with cached diff or returned JSON state51- If split-plan dependencies become circular or unclear, stop and re-plan52- NEVER push unless the user explicitly asked for it53- If a repo has custom commit rules, follow them over the fallback format54- If the user asks for only part of the work to be committed, leave the rest untouched5556Reference examples live in `references/git.md` and `references/but.md`; safety checks above are binding.5758## Return format5960Return a compact plain-text report:6162- `commits:` created commits with SHA + subject, oldest -> newest63- `validation:` commands run, skipped, or failed64- `changelog:` updated files or `none`65- `remaining:` clean worktree or remaining paths intentionally left uncommitted6667For preview-only or dry-run:6869- say `no commits created`70- print the proposed commit message(s) and split order instead7172## Reference routing7374Use the Required follow-up reads table near the top of this file; do not preload commit references before engine selection makes them relevant.7576Optional arguments: $ARGUMENTS