Git Commit Message
Use this skill to draft a commit message from staged Git changes.
Workflow
- Confirm the current directory is inside the target Git repository.
- Inspect staged changes only:
- Prefer
git status --short - Read
git diff --cached --stat - Read
git diff --cached --name-status - Read
git diff --cached --find-renames --find-copies --no-ext-diff
- Prefer
- Ignore unstaged and untracked changes unless the user explicitly asks to consider them.
- If there are no staged changes, say that no commit message can be generated from the index.
- Identify:
- primary intent of the staged change
- affected area or scope
- behavior change versus docs/tests/chore/refactor
- any breaking change, migration, or user-visible impact
- Draft the message in the style that best matches the repository's recent commits when practical. Check recent style with
git log -n 10 --pretty=format:%sif available. - Prefer a concise subject line under 72 characters.
- Add a body only when it clarifies multiple changes, risk, migration notes, or important rationale.
- Do not run
git add,git commit, amend, reset, checkout, or mutate files unless the user explicitly asks.
Portable Commands
Use plain Git commands so the workflow works across operating systems and shells:
git status --short
git diff --cached --name-status --find-renames --find-copies
git diff --cached --stat
git log -n 10 --pretty=format:%s
git diff --cached --find-renames --find-copies --no-ext-diff
For large diffs, inspect the staged file list and stat first, then read the most relevant staged file diffs with:
git diff --cached -- <path>
Message Format
Default to this shape unless the repository strongly suggests another style:
<type>(<scope>): <summary>
<body, only if useful>
Common types:
feat: user-facing capabilityfix: bug fixdocs: documentation-only changetest: test-only changerefactor: internal restructuring without behavior changechore: maintenance, config, metadata, generated filesbuild: build system or dependency changeci: CI configuration change
If the change does not fit Conventional Commits, use a plain imperative subject such as:
Update maintenance docs for project workflow
Output
Return one primary recommendation and, when useful, one or two alternatives.
Include a short note about the evidence used, such as staged files or diff highlights. Keep the final answer concise and do not paste the whole diff.