Back to list
rsicarelli

git-commit-guardian

by rsicarelli

Your Fakes at compile-time. Type-safe test fake generation for Kotlin Multiplatform via FIR/IR compiler plugin.

15🍴 1📅 Jan 24, 2026

SKILL.md


name: git-commit-guardian description: Enforces Conventional Commits format, validates message quality (72 char subject, 80 char body), and BLOCKS Claude Code pollution (co-author/generated-by markers). Use when committing, creating commits, git commit, or when user mentions "commit", "git commit", "commit message", "commit changes", "push changes". allowed-tools: [Read, Bash, Grep, Glob]

Git Commit Guardian

Enforces professional commit message standards with Conventional Commits format and prevents AI attribution pollution.

Core Mission

This skill ensures every commit follows industry best practices while eliminating Claude Code's default commit pollution (co-author lines, generated-by footers). Commits should be clean, professional, and follow the Conventional Commits specification.

Problem Solved: Claude Code by default adds "Generated with Claude Code" footers and "Co-Authored-By: Claude" lines to every commit. This pollutes git history and exposes AI usage unnecessarily. This skill blocks such patterns and enforces clean commits.

Instructions

1. Intercept Commit Intent

Detect when user wants to commit:

  • Direct: "commit", "git commit", "commit changes"
  • Indirect: "push this", "save changes to git", "create a commit"
  • After completing work: "done, commit it"

Immediately activate and validate before any commit action.

2. Analyze Staged Changes

Before crafting commit message:

# View staged files
git diff --cached --name-only

# View actual changes
git diff --cached

# Check for sensitive files (BLOCK if found)
git diff --cached --name-only | grep -E '\.(env|pem|key|credentials)$'

Determine appropriate commit type from changes:

  • New files with features → feat
  • Bug fixes → fix
  • Only docs/comments → docs
  • Only formatting → style
  • Code restructure, no behavior change → refactor
  • Performance improvements → perf
  • Test additions/fixes → test
  • Build system changes → build
  • CI configuration → ci
  • Maintenance/chores → chore

3. Validate Commit Message Format

Required format (Conventional Commits):

<type>[(scope)][!]: <description>

[optional body]

[optional footer]

Validation checklist:

  • Type is valid: feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert
  • Subject line ≤72 characters
  • Subject does NOT end with period
  • Subject uses imperative mood ("add" not "added", "fix" not "fixed")
  • Blank line between subject and body (if body exists)
  • Body lines wrapped at 80 characters
  • Breaking changes marked with ! or BREAKING CHANGE: footer

If validation fails:

COMMIT BLOCKED - Format Error

Subject line exceeds 72 characters (currently: 85)
Fix: Shorten to: "feat(compiler): add generic type support"

Original: "feat(compiler): add generic type parameter support for class-level generics in IR generation"

4. BLOCK Forbidden Patterns (CRITICAL)

These patterns MUST NEVER appear in commits:

FORBIDDEN PATTERNS - ALWAYS BLOCK

1. AI Attribution Footer:
   "Generated with [Claude Code]"
   "Generated with Claude Code"
   "Generated by Claude"
   "Generated by AI"

2. Co-Author Lines (any variation):
   "Co-Authored-By: Claude"
   "Co-authored-by: Claude"
   "Co-Authored-By: Claude Opus"
   "Co-Authored-By: Claude Sonnet"
   "Co-authored-by:.*Claude"
   "Co-authored-by:.*Anthropic"
   "Co-Authored-By:.*noreply@anthropic.com"

3. Emoji AI Markers:
   Lines starting with robot emoji followed by "Generated"

If forbidden pattern detected:

COMMIT BLOCKED - AI Attribution Detected

Found forbidden pattern in commit message:
  Line 5: "Co-Authored-By: Claude <noreply@anthropic.com>"

This project requires clean commits without AI attribution.
Remove the offending lines and retry.

Allowed footers: Closes #123, Fixes #456, BREAKING CHANGE:

This is NON-NEGOTIABLE. Always strip these before committing.

5. Craft Clean Commit Message

Message structure:

<type>(<scope>): <imperative description>

<optional body explaining what and why>

<optional footer: Closes #123, BREAKING CHANGE:, etc.>

Good examples:

feat(compiler): add generic type parameter support

Implements class-level generic handling in IR generation.
Method-level generics use identity function pattern.

Closes #42
fix(fir): resolve annotation detection for nested interfaces

The FIR phase was not traversing nested interface declarations.
Added recursive visitor pattern to detect @Fake at all levels.
refactor(generation): extract factory generation to dedicated class

Separates concerns between implementation and factory generation
for better maintainability and testing.
docs: update installation guide for Gradle 8.x

Bad examples (NEVER produce these):

Add generic type parameter support

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Updated some stuff
fix bug.

6. Execute Commit

Only after all validations pass:

git commit -m "$(cat <<'EOF'
<validated commit message here>
EOF
)"

Verify commit succeeded:

git log -1 --format="%H %s"

Output confirmation:

COMMIT SUCCESSFUL

Commit: a1b2c3d
Message: feat(compiler): add generic type parameter support

All validations passed:
- Conventional Commits format
- Subject: 47/72 characters
- No forbidden patterns
- Clean commit history maintained

7. Handle Edge Cases

Multiple logical changes:

Recommend splitting into multiple commits:
1. refactor(types): extract TypeResolver to separate file
2. feat(types): add variance handling for generic bounds
3. test(types): add unit tests for TypeResolver

Use: git add -p (patch mode) to stage selectively

Breaking changes:

feat(api)!: change factory function signature

BREAKING CHANGE: fakeXxx() now requires explicit configuration.
Migration: fakeXxx() → fakeXxx {}

Reverting commits:

revert: feat(compiler): add generic type parameter support

This reverts commit a1b2c3d.
Reason: Causing compilation errors in multi-module projects.

Supporting Files

Progressive disclosure for detailed documentation:

  • resources/conventional-commits-reference.md - Full Conventional Commits specification
  • resources/commit-message-patterns.md - Project-specific good/bad examples

This skill composes with:

  • bdd-test-runner - Run tests before committing
  • compilation-validator - Validate code compiles before committing

This skill enables:

  • Clean git history
  • Professional commit messages
  • Automated changelog generation (from conventional commits)
  • Semantic versioning automation

Best Practices

  1. One logical change per commit - Don't bundle unrelated changes
  2. Write for future readers - Explain why, not just what
  3. Use imperative mood - "add feature" not "added feature"
  4. Keep subject concise - 72 chars max, aim for 50
  5. Never include AI attribution - Clean, professional commits only
  6. Reference issues when relevant - Closes #123, Fixes #456
  7. Mark breaking changes explicitly - Use ! or BREAKING CHANGE: footer

Commit Type Reference

TypeWhen to UseExample
featNew feature for usersfeat(dsl): add configure block for behaviors
fixBug fix for usersfix(ir): resolve null pointer in type resolution
docsDocumentation onlydocs: add KMP setup guide
styleFormatting, no logic changestyle: apply ktfmt formatting
refactorCode restructure, same behaviorrefactor: extract visitor to separate class
perfPerformance improvementperf(analysis): cache interface metadata
testAdding/fixing teststest: add generic bounds test cases
buildBuild system, dependenciesbuild: upgrade Kotlin to 2.1.0
ciCI configurationci: add KMP matrix to GitHub Actions
choreMaintenance, toolingchore: update .gitignore patterns
revertReverting previous commitrevert: feat(api): change return type

Error Messages

Invalid Type

COMMIT BLOCKED - Invalid Commit Type

"update" is not a valid Conventional Commits type.

Valid types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert

Suggested fix: "feat: ..." or "fix: ..." depending on change nature

Subject Too Long

COMMIT BLOCKED - Subject Exceeds 72 Characters

Current: 89 characters
Limit: 72 characters

Original: "feat(compiler): implement comprehensive generic type parameter support for all interface variations"

Suggested: "feat(compiler): add generic type parameter support"

AI Attribution Detected

COMMIT BLOCKED - AI Attribution Detected

Line 4: "Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>"

This project maintains clean commits without AI attribution.
Remove this line to proceed.

Known Limitations

  • Skill activates on keyword detection; may miss indirect commit references
  • Cannot enforce rules if user bypasses skill and runs raw git commands
  • Body line wrapping is advisory (80 chars) not strictly enforced

References

Score

Total Score

70/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon