| name | git-commit-helper |
| description | Generate high-quality git commit messages following conventional commit format and repository conventions |
| allowed-tools | Bash, Read, Grep |
Git Commit Helper
Generate conventional commit messages that follow best practices and repository-specific conventions.
When to Use
- Creating commits with proper formatting
- Following team commit message standards
- Ensuring commit messages are clear and informative
Workflow
1. Analyze Changes
# Check current status
git status
# View staged changes
git diff --staged
# View recent commit messages for style
git log --oneline -10
2. Determine Commit Type
Choose appropriate type based on changes:
- feat: New feature
- fix: Bug fix
- docs: Documentation only
- style: Code style (formatting, missing semicolons, etc.)
- refactor: Code restructuring without behavior change
- perf: Performance improvement
- test: Adding or updating tests
- build: Build system or dependencies
- ci: CI/CD configuration
- chore: Maintenance tasks
3. Generate Commit Message
Format: <type>(<scope>): <description>
Rules:
- Use present tense ("add" not "added")
- Lowercase except for proper nouns
- No period at the end
- Max 50 characters for subject line
- Body explains "why" not "what" (optional)
- Reference issues when applicable
Examples:
feat(auth): add OAuth2 authentication support
fix(api): resolve null pointer in user endpoint
docs(readme): update installation instructions
refactor(utils): extract validation logic to helper
perf(database): optimize query with indexed lookup
test(auth): add integration tests for login flow
4. Review Before Committing
- Verify changes are related
- Check for debug code or console.logs
- Ensure tests pass
- Confirm no secrets are included
5. Create Commit
git commit -m "type(scope): description"
# With body
git commit -m "$(cat <<'EOF'
type(scope): description
Detailed explanation of why this change was made.
Fixes #123
EOF
)"
Best Practices
✅ DO:
- Keep commits atomic (one logical change)
- Write clear, specific descriptions
- Reference related issues
- Follow repository conventions
❌ DON'T:
- Commit unrelated changes together
- Use vague messages like "fix bug" or "update code"
- Include work-in-progress code
- Skip testing before committing
Examples
Feature Addition
feat(dashboard): add real-time data refresh
Implements automatic refresh every 30 seconds for
dashboard widgets. Users can disable in settings.
Closes #456
Bug Fix
fix(parser): handle edge case with empty arrays
Previous logic failed when encountering empty arrays
in nested objects. Updated validation to check array
length before processing.
Fixes #789
Documentation
docs(api): add examples for authentication endpoints
Added request/response examples and common error codes
to improve developer experience.
Refactoring
refactor(auth): extract JWT logic to service layer
Moved JWT creation and validation from controllers
to dedicated auth service for better testability.
Templates
Standard Commit
<type>(<scope>): <description>
With Body
<type>(<scope>): <description>
<body explaining why this change was needed>
<footer with issue references>
Breaking Change
feat(<scope>)!: <description>
BREAKING CHANGE: <explanation>
Migration guide:
1. Update X
2. Change Y
3. Remove Z
Commit Message Checklist
- Type is accurate (feat/fix/docs/etc.)
- Scope identifies affected area
- Description is clear and concise (<50 chars)
- Present tense used
- No period at end of subject
- Body explains why (if needed)
- Issues referenced (if applicable)
- All changes are related
- Tests have passed