| name | git-commit-guardian |
| description | Enforces Conventional Commits format, validates message quality (72 char subject, 80 char body), and BLOCKS AI attribution pollution. Use when committing changes, creating commit messages, or reviewing commit message quality. Make sure to use this skill whenever a git commit is being created — it prevents AI attribution trailers and enforces the project's strict Conventional Commits format. |
| allowed-tools | Read, Bash, Grep, Glob |
Git Commit Guardian
Enforces professional commit standards and prevents AI attribution pollution.
Instructions
1. Intercept Commit Intent
Detect: "commit", "git commit", "commit changes", "push this", "done, commit it".
Activate immediately before any commit action.
2. Analyze Staged Changes
git diff --cached --name-only
git diff --cached
git diff --cached --name-only | grep -E '\.(env|pem|key|credentials)$'
Determine commit type from changes:
feat — New feature files
fix — Bug fixes
docs — Only docs/comments
refactor — Restructure, same behavior
test — Test additions/fixes
build — Build system, dependencies
chore — Maintenance
Fakt-specific scopes: compiler, fir, ir, generation, analysis, dsl, gradle, annotations, samples
3. Validate Commit Message
Required format:
<type>[(scope)]: <description>
[optional body]
[optional footer]
Validation rules:
4. BLOCK Forbidden Patterns (CRITICAL)
These MUST NEVER appear in commits:
FORBIDDEN — ALWAYS BLOCK:
1. "Generated with [Claude Code]" / "Generated with Claude Code" / "Generated by Claude"
2. "Co-Authored-By: Claude" / "Co-authored-by:.*Claude" / "Co-authored-by:.*Anthropic"
3. "Co-Authored-By:.*noreply@anthropic.com"
4. Robot emoji + "Generated"
If detected:
COMMIT BLOCKED — AI Attribution Detected
Found: "Co-Authored-By: Claude <noreply@anthropic.com>"
This project requires clean commits without AI attribution.
Remove the offending line and retry.
NON-NEGOTIABLE. Always strip before committing.
5. Execute Commit
Only after all validations pass:
git commit -m "$(cat <<'EOF'
<validated commit message>
EOF
)"
Verify:
git log -1 --format="%H %s"
6. Handle Edge Cases
Multiple logical changes — recommend splitting:
1. refactor(types): extract TypeResolver to separate file
2. feat(types): add variance handling
3. test(types): add unit tests for TypeResolver
Error Messages
Invalid Type:
COMMIT BLOCKED — Invalid Type
"update" is not valid. Use: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert
Subject Too Long:
COMMIT BLOCKED — Subject exceeds 72 characters (currently: {n})
Suggested: "{shortened version}"
Supporting Files
resources/conventional-commits-reference.md — Full spec
resources/commit-message-patterns.md — Project-specific examples
Related Skills
bdd-test-runner — Run tests before committing
compilation — Validate code compiles before committing