Semantic Commit
Generate commit messages following the conventional commit format: <type>(<scope>): <subject>
Format
code
<type>(<scope>): <subject> <body>
- •type: Required. Category of change.
- •scope: Optional. Omit if unclear or not valuable.
- •subject: Present tense, no period, under 72 chars.
- •body: Optional. Explain what/why, not how. Wrap at 72 chars.
Types
| Type | Use for |
|---|---|
feat | New user-facing feature |
fix | Bug fix |
docs | Documentation only |
style | Formatting, whitespace (no logic change) |
refactor | Code change that doesn't fix or add |
test | Adding or updating tests |
chore | Build, CI, dependencies |
Rules
- •Subject line under 72 characters
- •Present tense ("add" not "added")
- •No period at end of subject
- •Blank line between subject and body
- •Body explains what/why, wrapped at 72 chars
- •Single-line OK for trivial changes
- •Non-trivial changes should include body
Examples
Trivial:
code
docs: fix typo in readme
Simple with scope:
code
feat(auth): add password reset flow
With body:
code
fix(api): handle empty response from upstream Add null check before parsing response body. Previously, empty responses from the payments service caused JSON parse errors.
Workflow
- •Review staged changes with
git diff --cached - •Identify the primary type and optional scope
- •Write subject summarizing the change
- •Add body for non-trivial changes explaining what/why
- •Commit using HEREDOC format for proper formatting