Generate Git Commit Message
Overview
This skill analyzes the current git staged changes and generates an appropriate English commit message. It follows Conventional Commits format and provides clear, informative commit messages that accurately reflect the nature of the changes.
Workflow
- Analyze Current State
First, check the current git status and staged changes.
Check current state
git status
Analyze staged changes
git diff --cached
Check recent commit history to understand the style
git log --oneline -5
- Generate Commit Message
Based on the staged changes analysis, generate an appropriate English commit message with:
Subject Line
-
Maximum 50 characters
-
Summary of the changes
-
Use Conventional Commits format:
-
feat:
-
New feature addition
-
fix:
-
Bug fix
-
refactor:
-
Code refactoring (no functional change)
-
test:
-
Test addition or modification
-
docs:
-
Documentation changes
-
chore:
-
Build process or auxiliary tool changes
-
style:
-
Code style changes (formatting, missing semicolons, etc.)
-
perf:
-
Performance improvements
-
ci:
-
CI configuration changes
Body (optional but recommended)
-
Detailed explanation of the changes
-
Reason for the changes
-
Impact scope
-
Blank line between subject and body
- Output Format
Generate commit messages in the following format:
<type>: <concise summary of changes>
<detailed description of what changed and why>
<impact scope or additional context if applicable>
Example
For a change that fixes a parameter format issue:
fix: Change servercode parameter format to use snake_case
Change trace_info.model_dump(by_alias=True) to by_alias=False to send parameters in snake_case format (request_id, trace_header, root_trace_id) instead of camelCase format (requestId, traceHeader, rootTraceId).
This resolves staging environment 504 errors where customer servercode expects snake_case parameter names according to the API specification.
Use Cases
-
Bug fix commit messages
-
Feature addition commit messages
-
Refactoring description
-
Configuration change recording
-
Maintaining consistent commit history
Guidelines
-
Be specific - Describe what actually changed, not vague descriptions
-
Focus on the "why" - Explain the reason for the change, not just the "what"
-
Keep it concise - Subject line should be scannable in git log
-
Match project style - Reference recent commits to maintain consistency
-
Technical accuracy - Ensure the message accurately reflects the code changes