Commit changes with a well-crafted message.
Auto-invoked when Claude needs to create a git commit. Use when asked to commit, save changes, or after completing work that should be committed.
$ARGUMENTS — optional commit description or guidance.
If empty, infer from staged/unstaged changes.
Run these in parallel:
git status — staged and unstaged changes (never use -uall)git diff --cached — what's already stagedgit diff — unstaged changes/commit request after finishing a task means "commit our work" — not "sweep up everything dirty in the tree". Pre-existing or user-made changes unrelated to the current task must not be bundled in silently.git diff and identify which hunks came from Edit/Write calls in this conversation vs. which were already there or added by the user.
agentic-commit -- file is fine.git apply --cached, or ask the user to confirm before including anything ambiguous. Never stage a whole file blind.Title (first line):
Body (optional, separated by blank line):
Footer (always present, separated by blank line):
---
Generated with the help of <agent harness and/or model name, URL (if available)>
<Co-Authored-By: Agent+Model email (if available)>
Example:
---
Generated with the help of Claude Code, https://claude.ai/code
Co-Authored-By: Claude Code Opus 4.6 <[email protected]>
If $ARGUMENTS provides a hint, use it to guide the message focus.
Use agentic-commit with a heredoc to stage files and commit in one call:
agentic-commit [-C <path>] -- file1 file2 ... <<'EOF'
<commit message>
EOF
On success it prints: <short-hash> <title-line>
On failure it prints git errors to stderr and exits non-zero.
Use a heredoc (<<'EOF') so the message can contain backticks and special characters.
The single quotes around EOF prevent shell expansion inside the message.
If a pre-commit hook fails:
git --git-dir — use git -C or cd then git in separate calls.cd path && git ... — the permission system matches on first token.git add -A or git add . — stage files by name.--no-verify) unless explicitly asked.