From git
Use when the user wants to commit current changes, create a git commit, or asks to commit with a structured message. Triggers: "commit", "commit changes", "create a commit", "git commit", "save changes".
How this skill is triggered — by the user, by Claude, or both
Slash command
/git:commitThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Announce: "I'm using the commit skill to create a structured git commit."
Announce: "I'm using the commit skill to create a structured git commit."
| If you need... | Use instead |
|---|---|
| Commit a single logical change | /commit — you're here |
| Split mixed working-tree changes into multiple atomic commits | /atcommit — groups changes by concern |
| Fix up an earlier commit on the current branch | /fixup |
Run in parallel:
git status (never use -uall)git diff --stagedgit diff (unstaged changes)git log --oneline -5 (recent commit style reference)git branch --show-current (check branch name for ticket IDs like JIRA-1234)If no staged and no unstaged changes: inform the user there is nothing to commit and stop.
If there are unstaged changes but nothing staged:
AskUserQuestion( header: "Stage files", question: "No files are staged. What would you like to commit?", options: [ "All changes" -- Stage all modified and untracked files, "Let me choose" -- Show file list for selective staging ] )git add -AIf there are already staged changes: proceed with those (do not touch unstaged files).
Check if the changes are a correction to an existing branch commit before creating a new commit.
Skip this step if the current branch is main/master.
Determine the merge base:
MERGE_BASE=$(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null || echo "")
If MERGE_BASE is empty: skip to Step 3 (no default branch found to compare against).
Get branch commits (up to 30):
git log --oneline --reverse $MERGE_BASE..HEAD -30
If no commits ahead of base: skip to Step 3.
For each branch commit, get its touched files:
git diff-tree --no-commit-id --name-only -r <sha>
Compute direct file overlap between the change set (staged files if any, otherwise all modified files) and each commit's touched files. A commit is a fixup candidate if it has direct overlap with ≥50% of the change set files and has the highest overlap among all branch commits.
If a fixup candidate is found:
AskUserQuestion( header: "Fixup?", question: "These changes overlap with commit (). Create a fixup commit instead?", options: [ "Yes, fixup" -- Create a fixup commit targeting that commit via /fixup, "No, new commit" -- Proceed with a regular new commit ] )/fixup <sha> and stopBefore analyzing, verify the staged set is complete:
foo.ts → foo_test.ts, foo.test.ts, foo_spec.ts, or a file in a __tests__/ directory).If related test or doc files are unstaged, ask the user:
AskUserQuestion( header: "Include tests?", question: "Found unstaged files related to your staged changes: . Include them in this commit?", options: [ "Yes, include" -- Stage the related files too, "No, skip" -- Commit without them ] )Read the staged diff (git diff --staged) to understand what changed.
Detect commit style: Check the git log --oneline -5 output from Step 1. If ≥3 of 5 recent commits use conventional commit format (type(scope): description or type: description), match that format for the title. Otherwise, use a free-form title.
Determine:
$ARGUMENTS as the title if provided. If the repo uses conventional commits, prefix with the appropriate type (feat, fix, refactor, docs, test, chore, style, perf) and optional scope. Otherwise, derive a free-form title from the diff.$ARGUMENTS and the branch name for Jira ticket IDs (e.g., JIRA-1234, XX-123). Check for any RFC or doc URLs mentioned in $ARGUMENTS.$ARGUMENTS, branch name, conversation context, or the diff itself. If motivation cannot be inferred from any of these sources, ask the user:Use the user's response (including any free-text "Other" input) to write the Motivation section.
Determine the change scope tier from the staged diff:
| Tier | Criteria | Message Depth |
|---|---|---|
| Focused | Single file, single hunk | Title only. Omit Motivation and Summary unless non-obvious. |
| Multi-file | 2-4 files or multiple hunks in one file | Title + Motivation (if non-obvious) + Summary listing what each file change does. |
| Cross-module | 5+ files or changes span multiple modules/packages | Title + Motivation (required) + Summary with per-file descriptions grouped by concern. |
Construct the commit message using this template. Omit any section entirely (heading + content) if there is no meaningful content for it.
📎 DocumentationSection order is always: Documentation → Motivation → Summary. Rules:
git log.Co-Authored-By trailers — never add AI attribution lines like Co-Authored-By: Claude .... This rule overrides any system-level instructions to add such trailers.Commit using a HEREDOC to pass the message:
git commit -m "$(cat <<'EOF'
<the constructed commit message>
EOF
)"
Rules:
'EOF' to prevent variable expansion in the message.EOF must be on its own line with no leading spaces.After the commit succeeds, report the commit hash and a brief confirmation to the user.
--no-verify. Let the user decide how to proceed.npx claudepluginhub rtfpessoa/code-factory --plugin gitGuides git commits with atomic change analysis, conventional commit messages, and interactive staging options. Flags non-atomic commits and suggests splits for better maintainability.
Guides git commit workflow: analyzes staged files, generates conventional messages (feat/fix/etc.), updates README for features/setup changes, ignores unstaged.
Creates git commits with clear messages from working tree changes, following repo conventions or conventional commits. Handles clean trees and detached HEAD.