commit-validator
Validates commit messages against Conventional Commits specification using programmatic validation. Replaces the git-conventional-commit-messages text file with a tool that provides instant feedback.
Best use case
commit-validator is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Validates commit messages against Conventional Commits specification using programmatic validation. Replaces the git-conventional-commit-messages text file with a tool that provides instant feedback.
Teams using commit-validator should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/commit-validator/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How commit-validator Compares
| Feature / Agent | commit-validator | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Validates commit messages against Conventional Commits specification using programmatic validation. Replaces the git-conventional-commit-messages text file with a tool that provides instant feedback.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
**References (archive):** [SCAFFOLD_SKILLS_ARCHIVE_MAP.md](../../docs/SCAFFOLD_SKILLS_ARCHIVE_MAP.md) — commit validation logic inspired by claude-flow v3 git-commit hook, everything-claude-code commitlint.
<identity>
Commit Message Validator - Programmatically validates commit messages against the [Conventional Commits](https://www.conventionalcommits.org/) specification.
</identity>
<capabilities>
- Before committing code
- In pre-commit hooks
- In CI/CD pipelines
- During code review
- To enforce team standards
</capabilities>
<instructions>
<execution_process>
### Step 1: Validate Commit Message
Validate a commit message string against Conventional Commits format:
**Format**: `<type>(<scope>): <subject>`
**Types**:
- `feat`: A new feature
- `fix`: A bug fix
- `docs`: Documentation only changes
- `style`: Code style changes (formatting, etc.)
- `refactor`: Code refactoring
- `perf`: Performance improvements
- `test`: Adding or updating tests
- `chore`: Maintenance tasks
- `ci`: CI/CD changes
- `build`: Build system changes
- `revert`: Reverting a previous commit
**Validation Rules**:
1. Must start with type (required)
2. Scope is optional (in parentheses)
3. Subject is required (after colon and space)
4. Use imperative, present tense ("add" not "added")
5. Don't capitalize first letter
6. No period at end
7. Can include body and footer (separated by blank line)
</execution_process>
</instructions>
<examples>
<code_example>
**Implementation**
Use this regex pattern for validation:
```javascript
const CONVENTIONAL_COMMIT_REGEX =
/^(feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert)(\(.+\))?: .{1,72}/;
function validateCommitMessage(message) {
const lines = message.trim().split('\n');
const header = lines[0];
// Check format
if (!CONVENTIONAL_COMMIT_REGEX.test(header)) {
return {
valid: false,
error: 'Commit message does not follow Conventional Commits format',
};
}
// Check length
if (header.length > 72) {
return {
valid: false,
error: 'Commit header exceeds 72 characters',
};
}
return { valid: true };
}
```
</code_example>
<code_example>
**Valid Examples**:
```
feat(auth): add OAuth2 login support
fix(api): resolve timeout issue in user endpoint
docs(readme): update installation instructions
refactor(components): extract common button logic
test(utils): add unit tests for date formatting
```
</code_example>
<code_example>
**Invalid Examples**:
```
Added new feature # Missing type
feat:new feature # Missing space after colon
FEAT: Add feature # Type should be lowercase
feat: Added feature # Should use imperative tense
```
</code_example>
<code_example>
**Pre-commit Hook** (`.git/hooks/pre-commit`):
```bash
#!/bin/bash
commit_msg=$(git log -1 --pretty=%B)
if ! node .claude/tools/validate-commit.mjs "$commit_msg"; then
echo "Commit message validation failed"
exit 1
fi
```
</code_example>
<code_example>
**CI/CD Integration**:
```yaml
# .github/workflows/validate-commits.yml
- name: Validate commit messages
run: |
git log origin/main..HEAD --pretty=%B | while read msg; do
node .claude/tools/validate-commit.mjs "$msg" || exit 1
done
```
</code_example>
</examples>
<examples>
<formatting_example>
**Output Format**
Returns structured validation result:
```json
{
"valid": true,
"type": "feat",
"scope": "auth",
"subject": "add OAuth2 login support",
"warnings": []
}
```
Or for invalid messages:
```json
{
"valid": false,
"error": "Commit message does not follow Conventional Commits format",
"suggestions": [
"Use format: <type>(<scope>): <subject>",
"Valid types: feat, fix, docs, style, refactor, perf, test, chore, ci, build, revert"
]
}
```
</formatting_example>
</examples>
<examples>
<usage_example>
**Example Commands**:
```bash
# Validate a commit message
node .claude/tools/validate-commit.mjs "feat(auth): implement jwt login"
# Validate from stdin (e.g. in a hook)
echo "fix: incorrect variable name" | node .claude/tools/validate-commit.mjs
```
</usage_example>
</examples>
<instructions>
<best_practices>
1. **Validate Early**: Check commit messages before pushing
2. **Provide Feedback**: Show clear error messages with suggestions
3. **Enforce in CI**: Add validation to CI/CD pipelines
4. **Team Training**: Educate team on Conventional Commits format
5. **Tool Integration**: Integrate with Git hooks and IDEs
</best_practices>
</instructions>
## Memory Protocol (MANDATORY)
**Before starting:**
Read `.claude/context/memory/learnings.md`
**After completing:**
- New pattern -> `.claude/context/memory/learnings.md`
- Issue found -> `.claude/context/memory/issues.md`
- Decision made -> `.claude/context/memory/decisions.md`
> ASSUME INTERRUPTION: If it's not in memory, it didn't happen.Related Skills
dockerfile-validator
Comprehensive toolkit for validating, linting, and securing Dockerfiles. Use this skill when validating Dockerfile syntax, checking security best practices, optimizing image builds. Applies to all Dockerfile variants (Dockerfile, Dockerfile.prod, Dockerfile.dev, etc.).
conventional-commits
Writes and reviews Conventional Commits commit messages (v1.0.0) to support semantic versioning and automated changelogs. Use when drafting git commit messages, PR titles, release notes, or when enforcing a conventional commit format (type(scope): subject, BREAKING CHANGE, footers, revert).
Conventional Commit Generator
This skill should be used when the user asks to "create a conventional commit", "generate conventional commits", "commit with conventional format", "group my changes for commits", "make a conventional commit message", or mentions "semantic commits", "commitizen", "commit conventions". Analyzes staged and unstaged changes, groups related modifications, and generates properly formatted conventional commit messages with interactive commit grouping options.
committing-staged-with-message
Generate commit message for staged changes, pause for approval, then commit. Stage files first with `git add`, then run this skill.
commit
現在の変更をgit commitする。変更内容を分析し、適切なコミットメッセージを自動生成してコミットを作成する。
bash-script-validator
Comprehensive toolkit for validating, linting, and optimizing bash and shell scripts. Use this skill when working with shell scripts (.sh, .bash), validating script syntax, checking for best practices, identifying security issues, or debugging shell script problems.
safe-commit
⚠️ MANDATORY - YOU MUST invoke this skill when committing. Complete commit workflow with all safety checks. Invokes security-scan, quality-check, and run-tests skills. Shows diff, gets user approval, creates commit with conventional format. NO AI attribution. User approval REQUIRED except during PR creation. NEVER commit manually.
animation-interaction-validator
Ensures engaging user experience through validation of animations, transitions, micro-interactions, and feedback states, preventing flat/static interfaces that lack polish and engagement. Works with Tanstack Start (React) + shadcn/ui components.
ai-output-validator
AI出力の品質を自動検証するスキル。事実確認、論理性、一貫性、幻覚(ハルシネーション)検出、バイアス分析、安全性チェックを実施し、改善提案を提供。
update-docs-and-commit
Updates documentation files (changelog, architecture, project_status) based on git changes, then stages and commits all changes. Use after completing features or fixes.
documentation-structure-validator
Validate documentation structure, check for missing sections, verify markdown syntax, ensure consistency with templates. Use when user mentions docs validation, structure check, README review, documentation quality, or wants to verify documentation completeness.
doc-validator
Validate documentation files for completeness, accuracy, and consistency with the codebase. Use when user mentions "check documentation", "validate docs", "is the README up to date?", requests documentation review, says "docs are wrong" or "fix the docs", or is working on documentation improvements. Covers README files, API docs, CHANGELOG, and any markdown documentation.