# Git Commit Guardian

> 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. Use when this capability is needed.

- Skill: `tomevault-io/git-commit-guardian` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/git-commit-guardian`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/git-commit-guardian/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/git-commit-guardian

---


# 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

```bash
git diff --cached --name-only
git diff --cached

# Check for sensitive files (BLOCK if found)
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:**
- [ ] Valid type: `feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert`
- [ ] Subject ≤72 characters
- [ ] No trailing period
- [ ] Imperative mood ("add" not "added")
- [ ] Blank line between subject and body
- [ ] Body lines wrapped at 80 characters

### 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:**

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

**Verify:**
```bash
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

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/rsicarelli) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-11 -->

