commit · git:20260805.41e58e8 · 2026-08-05 · sha256 674cd593f1ef4698
commit git:20260805.41e58e8A
Immutable. This exact content never changes and is served at /api/v1/blob/674cd593f1ef4698.
--- name: commit description: Commit staged/unstaged changes with a well-crafted commit message. argument-hint: "[--force] [<message hint>]" model: haiku --- # Commit Commit changes with a message that follows project conventions. `force` = true if `--force` is present in the arguments. `message_hint` = remaining text after stripping `--force`, or empty string if none was given. Example invocations: - `/commit` - `/commit Fix race condition in job queue` - `/commit Add webhook retry support` - `/commit --force` - `/commit --force Fix race condition in job queue` ## Steps ### 1. Gather Git Context Run in parallel: ```bash git status # staged, unstaged, and untracked files git diff HEAD --stat # summary of all uncommitted changes git diff HEAD | head -n 300 # capped diff; the stat output covers the rest git log --oneline -10 # recent commits for message style reference ``` If `git diff HEAD` fails (no commits yet), run `git diff --cached` instead. If `git status` shows a clean working tree with nothing staged, tell the user there is nothing to commit and stop. ### 2. Compose Commit Message **Format:** ```text <imperative subject line, ≤72 characters> [optional body — include only when the subject alone does not tell a reader why the change exists; omit entirely for small, obvious changes] [Fixes #<issue> — include only when this commit closes a GitHub issue] [trailers the coding tool mandates (e.g. Generated-By) — keep them last] ``` **Subject line rules:** - Follow the commit-message conventions in CLAUDE.md (imperative verb, final state not the journey, no volunteered AI attribution); no period at the end - If `message_hint` is non-empty, use it verbatim as the subject line (trim whitespace; do not rephrase) ### 3. Show Preview and Confirm If `force` is true, skip to Step 4 immediately — do not show a preview or ask for confirmation. Otherwise, display the proposed commit exactly as shown below, then stop and wait for the user to reply: ```text Files to commit: staged: <list, or "(none)"> unstaged: <list, or "(none)"> untracked: <list, or "(none)"> Commit message: <subject line> <body, if any> <Fixes line, if any> ``` Ask: "Commit with this message? Reply yes to confirm, or describe any changes." Do not proceed until the user replies. If the user requests changes, update the message and show the full preview again before asking once more. ### 4. Commit Stage specific files by name. Do not use `git add -A` or `git add .`. Use absolute paths in all bash commands. ```bash git add <absolute path to each file> git commit -m "$(cat <<'EOF' <message> EOF )" ``` ### 5. Report Result On success, show the short commit hash and subject line. On failure, show the full error output and stop.