--- name: conventional-commits description: > Git commit management following Conventional Commits specification for Aurora projects. Trigger: When creating commits, analyzing git history, or reviewing commit messages. license: MIT metadata: author: aurora version: "1.0" auto_invoke: "Creating commits, git operations, analyzing commit history" --- ## When to Use - User asks to create a commit or "commit changes" - User asks to review git status or diff - User wants to analyze commit history - After completing features/fixes that need to be committed - User mentions "conventional commits" or asks about commit format --- ## Critical Patterns ### Commit Format ``` (): [optional body] [optional footer] ``` ### Types (in order of usage frequency) | Type | Description | Example | |------|-------------|---------| | `feat` | New functionality | `feat(library/book): add ISBN validation` | | `fix` | Bug fix | `fix(auth): resolve token refresh race condition` | | `refactor` | Code refactoring, no functional change | `refactor(core): extract validation logic to service` | | `test` | Add or modify tests | `test(book): add unit tests for create handler` | | `docs` | Documentation changes | `docs(readme): add installation instructions` | | `chore` | Maintenance tasks | `chore(deps): update nestjs to v10` | | `style` | Formatting, semicolons, etc. | `style(api): apply prettier formatting` | | `perf` | Performance improvements | `perf(query): optimize book search with index` | | `ci` | CI/CD changes | `ci(github): add deployment workflow` | | `build` | Build system or dependencies | `build(docker): optimize production image` | | `revert` | Revert previous commit | `revert: feat(book): add ISBN validation` | ### Subject Rules 1. ✅ Use imperative mood: "add" NOT "added" or "adds" 2. ✅ Lowercase first letter 3. ✅ No period at the end 4. ✅ Maximum 120 characters 5. ✅ Describe WHAT, not HOW **Good:** - `feat(book): add publication date validation` - `fix(auth): resolve token refresh issue` **Bad:** - `feat(book): Added publication date validation` (past tense) - `fix(auth): Resolve token refresh issue` (uppercase) - `feat(book): add publication date validation.` (period) ### Body Rules (Optional) 1. Separate from subject with blank line 2. Explain WHY, not WHAT 3. Wrap at 72 characters per line 4. Can use bullet points with `-` ### Footer Rules (Optional) 1. Reference issues: `Closes #123`, `Fixes #456` 2. Breaking changes: `BREAKING CHANGE: ` 3. ❌ **NEVER** add "Co-Authored-By" or AI attribution --- ## Commit Workflow ### 1. Analyze Changes ```bash git status # See modified/untracked files git diff # See unstaged changes git diff --staged # See staged changes git log --oneline -10 # See recent commit style ``` ### 2. Group Related Changes **Rules:** - One commit = one logical change - ❌ Don't mix features with fixes - ❌ Don't mix multiple unrelated modules - ✅ Multiple files are OK if they implement one feature ### 3. Generate Message Analyze the changes and determine: 1. **Type**: feat, fix, refactor, etc. 2. **Scope**: Which module/component is affected? 3. **Subject**: What does this change do? 4. **Body** (if needed): Why was this change necessary? 5. **Footer** (if needed): Issue references, breaking changes ### 4. Execute Commit ```bash git add git commit -m "$(cat <<'EOF' ():