Commit Message Generator (Conventional Commits)
Generate commit messages following Conventional Commits 1.0.0.
Execution Style
-
Be concise and direct; avoid preambles or long plans.
-
Use explicit formatting and exact output requirements.
-
Infer type, scope, and breaking from the changes when possible; ask only if truly ambiguous.
-
Prefer tool-driven git commands over manual edits.
Workflow
Run git status and git diff HEAD .
Stage only user-specified files; if user requests "all", use git add -A .
Infer type/scope/breaking from the diff when possible; ask only if needed.
Draft subject, body, and footers.
Commit using HEREDOC:
git commit -m "$(cat <<'EOF' <type>(<scope>): <description>
<body>
<footer> EOF )"
Output <hash> <subject> only.
Scope Boundaries
-
Do: analyze changes, generate message, stage files, commit.
-
Don't: modify code, push, create branches, amend unless asked.
Format
<type>[optional scope][!]: <description>
[optional body]
[optional footer(s)]
Spec Requirements
-
Type is required; scope is optional and uses (<noun>) .
-
Description must follow : and be a short summary.
-
Body is separated from subject by one blank line.
-
Footer is separated from body by one blank line and uses <token>: <value> or <token> #<value> .
-
Breaking change must use the exclamation mark (!) after type/scope or a BREAKING CHANGE: / BREAKING-CHANGE: footer.
Types
-
feat : new feature (SemVer minor)
-
fix : bug fix (SemVer patch)
-
perf : performance improvement
-
refactor : restructure without behavior change
-
style : formatting only
-
test : add/update tests
-
docs : documentation only
-
build : build system/deps
-
ci : CI config
-
chore : other maintenance
-
revert : revert commit
Breaking changes: use the exclamation mark (!) after type/scope or add a BREAKING CHANGE: footer (MAJOR).
Subject
-
Max 72 chars (50 preferred).
-
Imperative, present tense; lowercase first letter.
-
No trailing period.
Scope
-
Optional; use a noun for the affected module or area.
-
Omit if unclear.
Body
- Explain what/why, not how; wrap at 72.
Footer
- Common tokens: BREAKING CHANGE , Refs , Closes , Fixes , Co-authored-by , Reviewed-by , Acked-by .
Examples
feat: add email notifications for new messages
fix(cart): prevent ordering with empty shopping cart
feat(api)!: redesign authentication endpoints
Migrate from session-based auth to JWT tokens.
BREAKING CHANGE: /api/login now returns JWT instead of session cookie.