| name | conventional-commit |
| description | Create git commits using Conventional Commits. Use when the user asks to commit code, prepare a commit, write a commit message, or standardize commit history with conventional commit types, scopes, breaking-change markers, and safe git workflow checks. |
Conventional Commit
Create focused git commits using the Conventional Commits format.
Commit Format
Use this structure:
<type>[optional scope][!]: <description>
[optional body]
[optional footer(s)]
Examples:
feat(auth): add password reset flow
fix(api): handle expired session tokens
docs: clarify deployment steps
refactor!: remove legacy payment adapter
Types
Prefer these types:
feat: a new user-facing or externally observable capability
fix: a bug fix
docs: documentation-only changes
style: formatting or style-only changes that do not affect behavior
refactor: code restructuring that neither fixes a bug nor adds a feature
perf: performance improvement
test: adding or updating tests only
build: build system, packaging, or dependency changes
ci: CI configuration or workflow changes
chore: maintenance work that does not fit another type
revert: revert a previous commit
Use the most specific accurate type. Do not use feat unless the change adds a new capability. Do not use fix unless it corrects broken behavior.
Scope
Add a scope when it improves clarity:
- Use a package, app, module, route, domain, or subsystem name.
- Keep scope lowercase and short, such as
api, auth, ui, deps, billing.
- Omit scope if the change is broad or no concise scope is obvious.
Description
Write the description in imperative mood, lowercase unless a proper noun requires capitalization.
- Good:
fix(auth): reject expired tokens
- Good:
docs: add local setup notes
- Avoid:
fixed auth token issue
- Avoid:
updates stuff
Keep the subject line concise, ideally 72 characters or less.
Breaking Changes
Mark breaking changes with ! after the type or scope and include a footer:
feat(api)!: require project id for exports
BREAKING CHANGE: Export requests must now include a project id.
Only mark a breaking change when existing consumers, persisted data, public APIs, commands, configuration, or documented behavior require migration.
Safe Workflow
Before committing:
- Run
git status --short to inspect modified, staged, and untracked files.
- Run
git diff and git diff --staged to understand unstaged and staged changes.
- Run
git log --oneline -n 10 to learn the repository's existing commit style.
- Identify which changes belong in this commit. Do not stage unrelated user changes.
- Do not commit secrets, credentials, local environment files, generated artifacts, or unrelated formatting churn.
- If there are suspicious files such as
.env, private keys, tokens, or credential JSON files, stop and ask before committing them.
When staging:
- Stage only files directly related to the requested commit.
- Preserve unrelated worktree changes.
- Prefer explicit paths with
git add <path>.
- Avoid broad staging with
git add . unless all changes have been reviewed and clearly belong together.
When committing:
- Decide whether the commit needs a body by applying the Commit Body criteria below.
- Use
git commit -m "<conventional subject>" when the subject fully communicates the change and its rationale is self-evident.
- Use multiple
-m flags when adding a body or footer.
- Do not bypass hooks with
--no-verify unless the user explicitly asks.
- Do not amend unless the user explicitly asks.
- Do not push unless the user explicitly asks.
After committing:
- Run
git status --short to verify the commit succeeded and confirm any remaining changes are intentional.
- Report the commit hash and message.
- Mention any uncommitted changes left behind.
Message Selection
Choose the message from the actual diff, not from the user's phrasing alone.
Use this decision process:
- If the diff is documentation only, use
docs.
- If the diff is tests only, use
test.
- If the diff changes build tooling, package metadata, lockfiles, or dependencies, use
build unless it is purely CI.
- If the diff changes CI files or automation workflows, use
ci.
- If the diff fixes incorrect behavior, use
fix.
- If the diff adds a new capability, use
feat.
- If the diff restructures code without behavior change, use
refactor.
- If the diff improves runtime performance, use
perf.
- If none apply and the work is maintenance, use
chore.
If multiple unrelated changes are present, ask whether to split them into separate commits unless the user already specified grouping.
Commit Body (Optional)
A commit body explains the reasoning or context behind the change. Consider one for every commit, but include it only when it adds durable information beyond the subject and diff.
Use a body when it helps a future reader understand one or more of:
- why the change was needed
- why this approach was chosen over an obvious alternative
- constraints, assumptions, or tradeoffs that shaped the implementation
- non-obvious behavior changes, side effects, or migration context
Write the body as concise prose focused on cause and intent. A body is unnecessary when the rationale is self-evident from the subject and diff.
Example:
fix(cache): avoid stale project permissions
Role updates were leaving cached permissions valid until their TTL expired. Include the role version in the cache key so permission changes take effect immediately without requiring broad cache invalidation.
Footers
Use footers for metadata such as issues, breaking changes, or co-authors:
Closes #123
Refs #456
BREAKING CHANGE: The config file now uses `projectId` instead of `id`.
Output Style
When done, respond briefly:
Committed `<hash>` with `type(scope): description`.
If no commit was created, explain why and list the blocker.