| name | conventional-commits |
| description | Conventional Commits specification, format, validation rules, and semantic-release integration. Use when creating commits, suggesting commit messages, validating commit format, or when working with semantic-release. |
Conventional Commits
This skill provides the complete specification for Conventional Commits format, validation rules, and integration with semantic-release.
When to Use
✅ DO Use:
- Creating commit messages
- Validating commit format
- Suggesting commit messages
- Creating PR titles
- Understanding semantic-release behavior
- Grouping commits by context
❌ DON'T Use:
- For release commits (automatically generated by semantic-release)
- For temporary or debug commits
Commit Format
<type>(<scope>): <subject>
[optional body]
[optional footer(s)]
Commit Types
Allowed Types
feat: New feature (generates MINOR version: 1.0.0 → 1.1.0)
fix: Bug fix (generates PATCH version: 1.0.0 → 1.0.1)
docs: Documentation-only changes (no release by default)
style: Formatting changes that don't affect code (no release by default)
refactor: Code refactoring without functionality changes (no release by default)
perf: Performance improvements (no release by default)
test: Adding or fixing tests (no release by default)
build: Build system or dependency changes (no release by default)
ci: CI/CD configuration changes (no release by default)
chore: Other changes that don't fit categories (no release by default)
revert: Reverts a previous commit
Type Prioritization
When determining commit type, prioritize in this order:
feat - For new features
fix - For bug fixes
refactor - For refactoring without behavior changes
docs - For documentation changes
test - For adding/fixing tests
chore - For maintenance tasks
Scope
The scope should indicate the affected code area.
When to Use Scope
- Use scope when the change affects a specific module/component
- Omit scope when the change affects multiple areas or is general
Common Scopes
Generic examples:
domain - Domain entities and business logic
service - Service layer
api - API endpoints
db - Database operations
auth - Authentication/authorization
utils - Utility functions
component - UI components
model - Data models
controller - Controllers
validator - Validation logic
Project-specific examples:
logging - Logging, enrichers, formatters
http - HttpClient, handlers
middleware - Middleware components
mvc - MVC-related code
webapi - Web API
config - Configuration
core - Core functionality
tests - Test files
Context-Based Scope Detection
For context-based commits:
- Use the main folder/module name (e.g., if file is in
Core/Domain/, scope is domain)
- For projects without clear structure, use
core or the main package name
- Group files by similar context (same parent folder or namespace)
Subject
The subject is a short, clear description of the change.
Subject Rules
- Lowercase (except proper nouns)
- Imperative mood: "add feature" not "added feature" or "adds feature"
- Maximum 72 characters
- No period at the end
- Always in English
- Objective and clear
Valid Subject Examples
add TraceContextEnricher for OpenTelemetry support
correct mongo connection retry strategy
document auth headers for endpoints
add unit tests for CNPJ rules
simplify normalization logic
Invalid Subject Examples
- ❌
Added new feature (past tense, not imperative)
- ❌
Adds support for X (third person, not imperative)
- ❌
Add new feature. (ends with period)
- ❌
Add new feature for logging that enriches trace context with TraceId SpanId and ParentSpanId (too long)
- ❌
adicionar novo recurso (not in English)
Complete Commit Examples
Valid Commits
feat(logging): add TraceContextEnricher for OpenTelemetry support
feat(domain): add loyalty card entity
feat(mvc): add RouteNameEnricher to include route name in logs
fix(service): correct mongo connection retry strategy
fix(middleware): ensure Activity is available in PreSendRequestHeaders
fix: resolve compiler warnings
docs(api): document auth headers for endpoints
docs: update README with new configuration options
refactor(utils): simplify normalization logic
refactor(core): simplify CorrelationContext implementation
test(validator): add unit tests for CNPJ rules
test(logging): add tests for TraceContextEnricher
perf(http): optimize HttpClient correlation ID injection
ci: update semantic-release configuration
chore: update dependencies to latest versions
Invalid Commits
Add new feature for logging
feature: add TraceContextEnricher
feat add new feature
feat(logging): add TraceContextEnricher that enriches trace context with TraceId SpanId and ParentSpanId from Activity.Current
feat: added new feature
feat: adds support for X
feat(logging): add TraceContextEnricher.
feat(logging): adicionar novo recurso
Context-Based Commits
Golden Rule
One commit = one context (when possible)
Process
- Group changes by context/folder/module
- Make separate commits by context:
- Order by dependency (innermost layers first, interfaces last)
- If there's no clear dependency, order alphabetically
- Don't mix different types in the same context:
refactor(domain) separate from feat(domain)
fix(service) separate from test(service)
Exceptions
- If all changes are from the same context and type, can be a single commit
- Formatting/linter changes can be grouped in
style or chore
Breaking Changes
If there's a contract/API break:
- Use
! in the type: feat(api)!: rename endpoint for ...
- Add footer:
BREAKING CHANGE: <short explanation in English>
Example:
feat(api): change method signature
BREAKING CHANGE: Method X now requires parameter Y instead of Z
This generates a MAJOR version (1.0.0 → 2.0.0).
Pull Request Format
PR Title (CRITICAL)
The PR title MUST follow EXACTLY the same semantic commit format, as semantic-release analyzes the merge commit title to determine whether to generate a new version.
Required Format:
<type>(<scope>): <subject>
PR Title Rules:
- MUST start with a valid type (
feat, fix, docs, etc.)
- MUST have a colon (
:) after the scope (or after the type if there's no scope)
- MUST be in lowercase (except proper nouns)
- MUST use imperative mood ("add feature" not "added feature")
- MUST NOT end with a period
- MUST have a maximum of 72 characters
- MUST NOT include PR number (GitHub adds it automatically)
PR Description Template
## Summary
Brief description of the implemented changes.
## Changes
- Item 1
- Item 2
- Item 3
## Release Type
- [ ] `feat` - New feature (MINOR)
- [ ] `fix` - Bug fix (PATCH)
- [ ] `BREAKING CHANGE` - Incompatible change (MAJOR)
## Related
- Closes #issue-number (if any)
## Checklist
- [ ] Code tested
- [ ] Documentation updated
- [ ] Tests added/updated
Validation Checklist
Before Suggesting Commit
Before Creating PR
Title Validation:
If any validation fails, fix it before suggesting.
Semantic Release Integration
Semantic-release analyzes commits using the angular preset with the following rules:
feat: → MINOR version (1.0.0 → 1.1.0)
fix: → PATCH version (1.0.0 → 1.0.1)
BREAKING CHANGE: → MAJOR version (1.0.0 → 2.0.0)
- Other types (
docs, chore, etc.) → No release (unless configured)
Commits that don't follow the pattern are ignored and don't generate a release.
GitHub CLI Usage
When creating PRs, use GitHub CLI (gh) instead of git push:
gh pr create --title "<type>(<scope>): <subject>" --body "<description>"
gh pr create --head <branch-name> --title "<type>(<scope>): <subject>" --body "<description>"
Never use git push origin main - always create feature branches and PRs.
Key Principles
- Format Consistency: Always use
<type>(<scope>): <subject> format
- Imperative Mood: Use "add", "fix", "update" (not "added", "fixed", "updated")
- Context Grouping: Group commits by context/module when possible
- Validation First: Always validate before suggesting commits
- Semantic Release: Format matters for automatic versioning
- English Only: All commit messages must be in English
- GitHub CLI: Use
gh pr create for PRs, not git push