Git Conventional Commits Skill
Professional git commit workflow that enforces best practices and conventions.
Features
-
Conventional Commits Format: Categorize commits by type (feat, fix, docs, style, refactor, perf, test, build, ci, chore)
-
Message Validation: Adheres to the 7 rules of great git commits:
-
Separate subject from body with a blank line
-
Limit the subject line to 50 characters
-
Capitalize the subject line
-
Do not end the subject line with a period
-
Use the imperative mood in the subject line
-
Wrap the body at 72 characters
-
Use the body to explain what and why vs. how
-
Auto-Detection: Intelligently detects commit type based on file changes
-
Preview & Confirmation: Shows formatted commit message before committing
-
Multi-Language Support: English and Traditional Chinese (繁體中文)
Commit Types
Type Description
feat
A new feature
fix
A bug fix
docs
Documentation only changes
style
Formatting, white-space, or semi-colon changes (no code meaning change)
refactor
A code change that neither fixes a bug nor adds a feature
perf
Code that improves performance
test
Adding missing tests or correcting existing ones
build
Changes to build-related components or dependencies
ci
Changes to the CI/CD setup
chore
Routine tasks or maintenance
When to Use
Reference this skill when you need to:
-
Create a git commit with proper conventional format
-
Ensure commit messages follow best practices
-
Auto-detect the type of change being committed
-
Preview and confirm commit messages before finalizing
-
Support multiple commit message languages
Example Usage
Invoke the skill when you have staged or unstaged changes
The skill will:
1. Analyze git status and changes
- Shows what files are modified/added/deleted
- Automatically stages appropriate files
2. Auto-detect commit type based on changes
- feat: New features (new files, new APIs)
- fix: Bug fixes (fixes existing functionality)
- docs: Documentation changes only
- style: Formatting changes (no logic change)
- refactor: Code restructuring (no logic change)
- perf: Performance optimizations
- test: Test additions/fixes
- build: Build system/dependency changes
- ci: CI/CD configuration changes
- chore: Maintenance tasks
3. Generate commit message
- Subject line: "{type}: {description}" (max 50 chars)
- Body (optional): Explains what and why
- Follows all 7 rules of great commit messages
4. DISPLAY PREVIEW - Saves to session temporary directory
Location: ~/.copilot/session-state/{session_id}/commit_preview.txt
Content (plain text, fully readable):
════════════════════════════════════════════════════════════
feat: Add user authentication
Implement JWT-based auth system with secure token handling
and automatic refresh logic. Prevents users from being logged
out unexpectedly during long sessions.
────────────────────────────────────────────────────────────
Files: 3 changed | +145 insertions | -8 deletions
════════════════════════════════════════════════════════════
Benefits of using session temp directory:
- Does NOT pollute your project directory
- Will NOT be tracked by git
- Automatically cleaned up when session ends
5. REQUEST USER CONFIRMATION
- User is asked: "Please review the commit message in
~/.copilot/session-state/{session_id}/commit_preview.txt
Do you want to proceed?"
- Mandatory: User must explicitly approve
- Options: ✅ Yes, confirm and commit | ❌ No, cancel commit
6. EXECUTE COMMIT (Only if confirmed)
If user approves:
git commit -m "feat: Add user authentication" \
-m "Implement JWT-based auth system..."
If user declines:
Commit cancelled by user. (No changes made)
Important: Preview & Confirmation
This skill ALWAYS shows a preview and waits for explicit user confirmation before committing.
This prevents accidental commits and ensures quality control. The preview step is mandatory and cannot be skipped.
Preview File Location: ~/.copilot/session-state/{session_id}/commit_preview.txt
-
Automatically cleaned up when session ends
-
Not tracked by git
-
Easy to find in your session folder
Configuration
-
Default Language: English
-
Commit Body: Optional (automatically included when explaining "why" for complex changes)
-
Message Validation: All messages validated against 7 rules before committing
-
Preview Storage: Session temporary directory (not project directory)
Important: Preview & Confirmation
This skill ALWAYS shows a preview and waits for explicit user confirmation before committing.
This prevents accidental commits and ensures quality control. The preview step is mandatory and cannot be skipped.
Configuration
-
Default Language: English
-
Commit Body: Optional (automatically included when explaining "why" for complex changes)
-
Message Validation: All messages validated against 7 rules before committing