From commit
Create well-structured git commits with context-aware message generation, plan awareness, and support for common commit workflow variants. Use when the user says "commit", "commit the changes", "commit and push", "commit the plan", "commit staged", "commit just the staged changes", "give the plan a meaningful name and commit", or any variant involving committing code changes.
How this skill is triggered — by the user, by Claude, or both
Slash command
/commit:commitThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Create smart, context-aware git commits with conventional commit messages.
Create smart, context-aware git commits with conventional commit messages.
Always prefer committing in the smallest logical chunks that are appropriate. Each commit should represent a single coherent change: one bug fix, one new function, one refactor, one documentation update, etc. Do not batch unrelated changes into a single commit.
Why this matters:
What constitutes a "logical chunk":
What does NOT belong in the same commit:
The user may provide these options inline:
Run these commands in parallel to understand the current state:
# See all changed and untracked files
git status
# See staged changes
git diff --cached
# See unstaged changes
git diff
# See recent commit messages for style reference
git log --oneline -10
If there are no changes at all (no staged, unstaged, or untracked files), report that there is nothing to commit and stop.
First, resolve which files are in scope using these rules in order:
--staged was specified: Only staged files are in scope. If nothing is staged, report that and stop.--plan was specified: See the Plan-Aware Commits section.--all was specified: All changes (staged, unstaged, and untracked) are in scope, but still exclude likely secret files (see below).Never stage files that likely contain secrets (.env, credentials.json, *.pem, *.key, etc.). If such files are detected among untracked or unstaged changes, warn the user and exclude them.
Review the in-scope changes and group them into the smallest logical chunks. Each chunk should be a self-contained, coherent change that makes sense on its own.
How to identify chunks:
Common chunk patterns:
When there is only one logical chunk: Proceed directly to step 4 with all in-scope changes.
When there are multiple logical chunks: Process each chunk sequentially, repeating steps 4 through 6 for each one. Stage only the files belonging to the current chunk before committing. Report the plan (number of commits and a brief description of each) before creating the first commit.
Before generating a message, examine the output from git log --oneline -10 to understand the repository's commit message conventions:
type: description)?feat, fix, chore, docs, refactor, test, etc.)?Match the repository's existing style. If there is no clear convention, default to conventional commits format.
Analyze the diff to generate a commit message:
feat: New functionalityfix: Bug fixdocs: Documentation changes onlyrefactor: Code restructuring without behavior changetest: Adding or updating testschore: Build, tooling, or maintenance changesstyle: Formatting, whitespace, or cosmetic changesfix/issue-42-login-bug suggests fixes #42).All commits must be GPG signed. Use a HEREDOC for the commit message to ensure proper formatting:
git commit -S -m "$(
cat << 'EOF'
type: description here
EOF
)"
CRITICAL: Never use git commit --amend. Always create a new commit. If a pre-commit hook fails, fix the issue, re-stage, and create a new commit.
After a successful commit:
git status to verify success.--push was specified: Push to the remote.git push
If the branch has no upstream, use:
git push -u origin HEAD
When the user mentions "commit the plan" or --plan is specified, or when plan files are detected among the changes, apply the rules in this section.
Plan files live under docs/plans/ and its subdirectories (todo/, done/). Look for Markdown files in these directories among the changed or untracked files.
Well-named plans follow the pattern YYYY-MM-DD-meaningful-description.md. Auto-generated names use nonsensical word combinations (e.g., ethereal-booping-sunbeam.md, quizzical-imagining-cerf.md).
Every time a plan file is part of a commit, check its filename. If the name lacks a datestamp prefix or uses a nonsensical auto-generated name:
consolidate-ci-workflows, add-user-authentication).YYYY-MM-DD-<slug>.md, using the current date for new plans or the date from the plan's title/content if one is stated.If the filename already has a datestamp prefix and a meaningful description, leave it as-is.
When committing code changes alongside a plan file, or when all the work described in a plan is being committed:
docs/plans/done/ (creating the directory if it does not exist). If both a rename and a move apply, perform a single git mv from the original path directly to the final destination (e.g., docs/plans/done/YYYY-MM-DD-slug.md).docs/plans/todo/, the move goes from todo/ to done/.docs/plans/ root, the move goes from there to done/.Do not move a plan to done/ if the work is only partially complete. Plans for work still in progress should stay in docs/plans/todo/ or the docs/plans/ root.
Commit only the plan file(s):
docs: add plan for <meaningful-description> where the description is derived from the plan's content or title.Create two sequential commits:
git mv from the original path directly to the final done/ destination (e.g., docs/plans/done/YYYY-MM-DD-slug.md). Stage and commit the plan file with a docs: message.When the user gives compound instructions like "commit, then push" or "commit and push":
--push.git pull --rebase first. Never force push unless the user explicitly requests it.Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub cboone/agent-harness-plugins --plugin commit