| name | commit |
| description | Stage and commit the working tree, splitting unrelated changes into separate conventional commits. Use when the user says 'commit this', 'save my work', 'wrap this up', 'check in the changes', wants the working tree split into logical commits with conventional-commit messages, or is ready to record progress in git before moving on. |
Stage and commit the current working tree.
Guardrails
A few things that matter, and why:
- Keep commits focused โ one concern per commit. A bug fix and a refactor, even if both are tiny, go in separate commits. This is what makes
git log and git blame useful later, and it's what lets reviewers (and git revert) isolate one change without dragging in others.
- Don't push, force-push, amend, reset, or touch the remote. Those belong to
/pr or the user. This skill's job ends at the local commit โ staying in that lane keeps the two operations reviewable independently.
- Don't bypass pre-commit hooks with
--no-verify. Hooks exist to catch real problems (lint, types, secrets). If one fails, the commit didn't happen โ fix the underlying issue and commit again. Do not --amend after a hook failure: since the commit didn't land, --amend would rewrite the previous commit, quietly overwriting earlier work.
- Stage explicit paths, not
git add . / -A. Wildcards sweep in whatever's lying around โ .env, credentials, build artifacts, half-finished scratch files. Naming paths explicitly keeps that stuff out.
- Follow the global CLAUDE.md rule: "Split commits by logical concern; each commit leaves the codebase working."
Steps
-
Survey the working tree โ run in parallel:
git status
git diff --stat
git log --oneline -10
status + diff --stat show the full picture of what changed.
log --oneline -10 shows the repo's existing commit style so your messages match it.
- If the tree is clean (nothing staged, nothing unstaged, no untracked relevant files), stop and tell the user there's nothing to commit.
-
Read the actual diffs โ for any files where the nature of the change isn't obvious from the path, run git diff <file> (or git diff --cached <file> for already-staged changes) so you understand what each hunk does. Don't guess โ a file named auth.go could contain a typo fix or a complete rewrite.
-
Group by logical concern โ walk every changed file and assign it to exactly one commit group. Valid concern boundaries:
- A new feature or capability (
feat:)
- A bug fix (
fix:)
- A refactor that preserves behavior (
refactor:)
- Docs-only changes (
docs:)
- Test additions or fixes (
test:)
- Config, tooling, or build changes (
chore:, build:, ci:)
- Performance work (
perf:)
- Security fixes (
security:)
Rules:
- A single file can be split across commits using
git add -p if its hunks belong to different concerns. Prefer this over lumping.
- If two groups depend on each other (group B doesn't build without group A), order them so each commit leaves the codebase working.
- If the tree really does represent one concern, one commit is correct โ don't invent splits.
-
Draft commit messages โ for each group:
- Type: feat / fix / refactor / docs / test / chore / perf / security / build / ci
- Subject: imperative mood, under 72 chars, no trailing period. Describe the outcome, not the mechanism. (
fix: reject empty passwords not fix: added if statement)
- Body (optional): only when the why is non-obvious โ a hidden constraint, a past incident, a tradeoff the reader wouldn't infer from the diff. Skip the body for self-evident changes.
- Match the casing and style of recent commits from step 1.
-
Present the plan โ show the user the full commit plan BEFORE touching git:
Commit 1/N โ <type>: <subject>
Files:
path/to/file1
path/to/file2
[Body if present]
Commit 2/N โ ...
Wait for explicit approval. Accept:
- "yes" / "proceed" / "looks good" โ commit as planned
- Targeted edits โ
"merge 2 and 3", "reword commit 1 as ...", "move file X from commit 2 to commit 1", "drop commit 3 entirely" โ revise the plan and re-present until approved
- "no" / "stop" โ abort, leave the working tree untouched
-
Commit sequentially โ for each approved group:
-
On pre-commit hook failure โ stop immediately. Show the user:
- The exact hook error output
- Which commit was being created
- The current index state (
git status)
Ask how to proceed. Common paths: fix the issue and retry as a new commit (not --amend), or unstage and escalate to the user. Never bypass with --no-verify.
-
Report โ after all commits land:
git status
git log --oneline -<N>
where <N> is the number of commits created. Show both to the user so they can verify the result and see the new history.
Scope boundary
This skill is local-only. It stops after the final git log. If the user wants to push and open a PR, they run /pr next.