Conventional Commit
Write a well-structured commit message following the Conventional Commits specification.
When to use
- The user asks to "write a commit message" or "commit these changes"
- Changes are staged and ready to commit
- The user wants consistent, parseable commit history
When NOT to use
- The user has their own commit message format documented in §10 of their project's Copilot instructions
- The project uses a different commit convention (check §4 and §10 of the project's Copilot instructions first)
Steps
-
Read the staged changes — Run
git diff --cached --statto see which files changed, thengit diff --cachedfor the full diff. -
Determine the type — Choose the most appropriate type:
Type When to use featA new feature or capability fixA bug fix docsDocumentation-only changes styleFormatting, whitespace, semicolons — no logic change refactorCode change that neither fixes a bug nor adds a feature perfPerformance improvement testAdding or correcting tests buildBuild system or external dependency changes ciCI configuration changes choreMaintenance tasks that don't modify src or test files -
Determine the scope — Identify the primary area affected (e.g.,
auth,api,ci,docs). Use the directory name or module name. Omit scope if the change spans many areas. -
Write the subject line — Format:
<type>(<scope>): <imperative summary>- Use imperative mood ("add", not "added" or "adds")
- Lowercase first letter after the colon
- No period at the end
- Maximum 72 characters
-
Write the body (if the change is non-trivial):
- Blank line after the subject
- Explain what changed and why (not how — the diff shows how)
- Wrap at 72 characters
- Reference issue numbers if applicable:
Fixes #123,Closes #456
-
Add breaking change footer (if applicable):
- Add
!after the type/scope:feat(api)!: remove v1 endpoints - Add footer:
BREAKING CHANGE: <description of what breaks and migration path>
- Add
-
Present the message — Show the complete commit message for user review:
<type>(<scope>): <subject> <body> <footer> -
Wait for approval — Do not run
git commituntil the user approves or modifies the message.
Verify
- Type is one of the standard Conventional Commits types
- Subject line is imperative mood, ≤ 72 characters, no trailing period
- Body explains what and why (if present)
- Breaking changes have both
!marker andBREAKING CHANGE:footer - The message accurately describes all staged changes
