# Commit Message Conventions
## Rule
All commit messages MUST follow the Conventional Commits specification.
## Format
```
<type>(<scope>): <subject>
[body]
[footer]
```
## Requirements
### Subject Line
- Use imperative mood: "Add feature" NOT "Added feature" or "Adds feature"
- Maximum 72 characters
- No period at the end
- Capitalize first letter after type prefix
### Type (Required)
- `feat`: New feature (MINOR version bump)
- `fix`: Bug fix (PATCH version bump)
- `docs`: Documentation changes
- `style`: Code formatting (no logic change)
- `refactor`: Code restructure (no behavior change)
- `perf`: Performance improvement
- `test`: Test additions or corrections
- `chore`: Build process, dependency updates
- `ci`: CI/CD configuration changes
- `revert`: Reverting a previous commit
### Scope (Optional)
- Module or component name in parentheses
- Examples: `feat(auth)`, `fix(api)`, `docs(readme)`
### Body (Optional)
- Explain WHY the change was made, not WHAT changed
- Wrap at 72 characters per line
- Separate from subject with a blank line
### Footer (Optional)
- Reference issues: `Refs: #123`
- Close issues: `Closes: #456`
- Breaking changes: `BREAKING CHANGE: description`
- Co-authors: `Co-authored-by: Name <email>`
## Examples
### Good
```
feat(auth): add Google OAuth2 login flow
Implement OAuth2 authorization code flow with PKCE for
Google sign-in. Uses the existing session management
infrastructure.
Closes: #234
```
```
fix(api): handle null response from payment gateway
The Stripe webhook handler crashed when receiving a
payment_intent.succeeded event with no metadata field.
Added null check and default values.
Refs: #567
```
### Bad
```
fixed stuff
update code
WIP
misc changes
Final fix (hopefully)
```
## Enforcement
Configure commitlint with husky or lefthook to validate
every commit message automatically. Reject non-compliant
commits at the pre-commit hook level.