From git
Enforces git commit policies (message format, confirmation, attribution). Use when user says "commit", "커밋", "커밋 해줘", "커밋 진행", asks to commit changes, or when preparing a git commit or push.
How this skill is triggered — by the user, by Claude, or both
Slash command
/git:git-policy-enforcementThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Enforce git policies defined by `/policy-setup`. This skill automatically applies configured rules during git operations, ensuring consistent and compliant commits across the project.
Enforce git policies defined by /policy-setup. This skill automatically applies configured rules during git operations, ensuring consistent and compliant commits across the project.
git commit or git pushBefore any git operation, load .claude/git-policy.json:
{
"version": "1.0",
"projectType": "private",
"policies": {
"commitConfirmation": { "enabled": true },
"commitMessageFormat": { "ticketMethod": "custom", "currentTicket": "PROJ-123" },
"coAuthoredBy": { "method": "yes_no_email" }
}
}
If file doesn't exist, guide user to run /policy-setup first.
Analyze staged changes and auto-generate a commit message with policy format applied:
commitMessageFormat.ticketMethod immediately:Generated: feat: add login
Generated: [NT] feat: add quick improvement
Process:
1. Extract ticket from branch name (regex: [A-Z]+-\d+)
2. Prepend ticket to generated message
Generated: [PROJ-123] feat: add authentication
Process:
1. Check currentTicket in policy config
2. If not set, ask user: "What ticket/issue?"
3. Store answer in currentTicket
4. Prepend ticket to generated message
Generated: [PROJ-123] feat: add authentication
If user already provided a commit message:
If coAuthoredBy.method !== "no":
Append attribution to commit message using current model name and auto-detected email domain:
For method: "yes_no_email" (private projects):
[existing commit message]
Co-Authored-By: [CURRENT_MODEL_NAME]
For method: "yes_with_email" (personal/public projects):
[existing commit message]
Co-Authored-By: [CURRENT_MODEL_NAME] <[AUTO_EMAIL]>
Email auto-detection (based on current model):
Note: Model name and email are determined at enforcement time, allowing attribution to automatically change if model changes between commits.
Rules:
If commitConfirmation.enabled === true:
Use AskUserQuestion to confirm commit, showing the fully formatted final message:
Q: "Ready to commit these changes?"
Header: "Commit Confirmation"
Options:
- "Yes, commit now"
- "Edit message"
- "Cancel commit"
Display summary:
[TEST] feat: add git policy system
Co-Authored-By: Claude Sonnet 4.6
Only proceed if user confirms "Yes, commit now". If user selects "Edit message", accept new message and re-apply format validation.
Once all validations pass and confirmations received:
appliedAt timestamp in policy config| Enabled | Behavior |
|---|---|
true | Prompt user before each commit/push with Ask tool |
false | Proceed with commit without confirmation prompt |
| Method | Validation | Action on Failure |
|---|---|---|
| none | Only Conventional type check | Reject, explain, request fix |
| no_ticket | Requires [NT] prefix | Reject, show format, request fix |
| branch | Extract from branch, validate | Extract, prepend, validate |
| custom | Requires currentTicket set | Ask user for ticket if missing |
| Method | Format | Appended |
|---|---|---|
| no | None | Not appended |
| yes_no_email | Co-Authored-By: Claude Haiku 4.5 | Always |
| yes_with_email | Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> | Always |
{
"commitConfirmation": { "enabled": false },
"commitMessageFormat": { "ticketMethod": "none" },
"coAuthoredBy": { "method": "no" }
}
Flow:
{
"commitConfirmation": { "enabled": true },
"commitMessageFormat": { "ticketMethod": "custom", "currentTicket": "PROJ-123" },
"coAuthoredBy": { "method": "yes_no_email" }
}
Flow:
Co-Authored-By: [CURRENT_MODEL] (without email){
"commitConfirmation": { "enabled": false },
"commitMessageFormat": { "ticketMethod": "branch" },
"coAuthoredBy": { "method": "yes_with_email" }
}
Flow:
feature/ISSUE-456-authCo-Authored-By: [CURRENT_MODEL] <noreply@anthropic.com> (with email)Error: .claude/git-policy.json not found
Action:
1. Suggest running /policy-setup
2. Offer to apply default policies
3. Ask if user wants to proceed without enforcement
Error: Commit message does not match policy [ticketMethod: custom]
Current: "fix: resolve bug"
Expected: "[PROJ-123] fix: resolve bug"
Action:
1. Show expected format
2. Suggest correction
3. Ask user to fix message
4. Retry validation
Status: Ticket not configured for this session
Question: "What ticket are you working on?"
Action:
1. Store user response in currentTicket
2. Update policy config
3. Retry commit
For detailed enforcement rules and scenarios:
references/enforcement-rules.md - Complete validation specificationsnpx claudepluginhub harry-jk/claude-plugin --plugin gitManages Git commit workflow using Conventional Commits format with safety protocols. Creates, validates, executes commits; handles hooks, PRs, and safety checks before operations.
Analyzes uncommitted changes, groups by cohesion, and generates commit messages matching project style. Outputs git commands or executes with --execute.
Creates git commits with repo detection, pre-commit checks, submodule support, and conventional messages. Activates on /commit or git commit requests.