Commit Skill
Generate meaningful, well-structured git commits following Conventional Commits specification.
When to Use This Skill
Use this skill when the user:
- Asks to "commit" or "make a commit"
- Says "commit my changes" or "save my work"
- Wants help writing a commit message
- Asks "what should I commit?"
- Needs to commit after completing a task
Conventional Commits Format
All commits must follow this format:
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
Commit Types
| Type | Description | Example |
|---|
| New feature or functionality | feat(auth): add login with Google
|
| Bug fix | fix(cart): resolve quantity update issue
|
| Documentation changes only | docs(readme): update installation steps
|
| Code style (formatting, semicolons, no logic change) | style(button): fix indentation
|
| Code change that neither fixes bug nor adds feature | refactor(api): simplify error handling
|
| Performance improvement | perf(query): optimize database lookup
|
| Adding or updating tests | test(auth): add login unit tests
|
| Build system or external dependencies | build(deps): upgrade react to v19
|
| CI/CD configuration changes | ci(github): add deploy workflow
|
| Other changes (tooling, configs) | chore(eslint): update lint rules
|
| Revert a previous commit | revert: undo login changes
|
Scope Guidelines
Scope should reflect the area of the codebase affected:
- Component names: , ,
- Feature areas: , , ,
- Technical areas: , , ,
- File types: , , ,
Commit Workflow
Step 1: Check Current Status
Review what files have been modified, added, or deleted.
Step 2: Review Changes
If nothing is staged, check unstaged changes:
Step 3: Stage Changes
Stage specific files:
Or stage all changes:
Step 4: Generate Commit Message
Analyze the staged changes and generate an appropriate commit message:
- Identify the primary change type - Is it a feature, fix, refactor, etc.?
- Determine the scope - What component/area is affected?
- Write a concise description - What does this change do? (imperative mood)
- Add body if needed - For complex changes, explain the "why"
Step 5: Execute Commit
bash
git commit -m "<type>(<scope>): <description>"
For multi-line commits:
bash
git commit -m "<type>(<scope>): <description>" -m "<body>"
AI Message Generation Rules
When generating commit messages from staged changes:
- Analyze the diff to understand what changed
- Identify patterns:
- New files → likely or
- Modified logic → could be , , or
- Only formatting →
- Config files → or
- Test files →
- Documentation →
- Extract scope from file paths or component names
- Write description in imperative mood ("add" not "added")
- Keep it under 72 characters for the subject line
Message Quality Guidelines
Good Commit Messages
feat(auth): add password reset functionality
fix(cart): prevent negative quantity values
refactor(api): extract common error handling logic
docs(contributing): add PR template guidelines
test(checkout): add integration tests for payment flow
Bad Commit Messages (Avoid)
fix bug # Too vague
updated files # No context
WIP # Not descriptive
asdfasdf # Meaningless
feat: stuff # No scope, vague description
Breaking Changes
For breaking changes, add
after the type/scope and include
in the footer:
feat(api)!: change authentication endpoint response format
BREAKING CHANGE: The /auth/login endpoint now returns { token, user }
instead of just the token string.
Multiple Changes
If changes span multiple concerns, prefer atomic commits:
bash
# Instead of one big commit, split into logical units:
git add src/components/Button.tsx
git commit -m "refactor(button): extract common styles"
git add src/components/Button.test.tsx
git commit -m "test(button): add accessibility tests"
Example Workflow
User: "commit my changes"
- Run to see changes
- Run (or if nothing staged)
- Analyze the changes
- Suggest: "Based on your changes, I recommend:"
feat(dashboard): add user activity chart component
- Ask: "Should I commit with this message, or would you like to modify it?"
- Execute the commit
Tips
- One logical change per commit - Makes history easier to navigate
- Present tense, imperative mood - "add" not "adds" or "added"
- No period at the end of the subject line
- Capitalize the first letter of the description
- Reference issues in the footer when applicable: