commit-validator
БесплатноЗапускает вложенные скриптыНе проверенValidates commit messages against Conventional Commits specification using programmatic validation. Replaces the git-conventional-commit-messages text file…
от oimiragieo★ 48 звёзд на GitHubОб этом скилле
References (archive): SCAFFOLD_SKILLS_ARCHIVE_MAP.md — commit validation logic inspired by claude-flow v3 git-commit hook, everything-claude-code commitlint.
Step 1: Validate Commit Message
Validate a commit message string against Conventional Commits format:
Format: <type>(<scope>): <subject>
Types:
feat: A new featurefix: A bug fixdocs: Documentation only changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringperf: Performance improvementstest: Adding or updating testschore: Maintenance tasksci: CI/CD changesbuild: Build system changesrevert: Reverting a previous commit
Validation Rules:
- Must start with type (required)
- Scope is optional (in parentheses)
- Subject is required (after colon and space)
- Use imperative, present tense ("add" not "added")
- Don't capitalize first letter
- No period at end
- Can include body and footer (separated by blank line)
Use this regex pattern for validation:
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 };
}
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
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
#!/bin/bash
commit_msg=$(git log -1 --pretty=%B)
if ! node .claude/tools/cli/validate-commit.mjs "$commit_msg"; then
echo "Commit message validation failed"
exit 1
fi
# .github/workflows/validate-commits.yml
- name: Validate commit messages
run: |
git log origin/main..HEAD --pretty=%B | while read msg; do
node .claude/tools/cli/validate-commit.mjs "$msg" || exit 1
done
Returns structured validation result:
{
"valid": true,
"type": "feat",
"scope": "auth",
"subject": "add OAuth2 login support",
"warnings": []
}
Or for invalid messages:
{
"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"
]
}
# Validate a commit message
node .claude/tools/cli/validate-commit.mjs "feat(auth): implement jwt login"
# Validate from stdin (e.g. in a hook)
echo "fix: incorrect variable name" | node .claude/tools/cli/validate-commit.mjs
Iron Laws
- ALWAYS validate commit messages in both pre-commit hook and CI — pre-commit catches local violations; CI catches cases where the hook was bypassed or not installed; both layers are required.
- NEVER accept commit messages without a type prefix — conventional commit format (
type: subject) is the foundation; messages without a type are unparseable for changelog generation and semantic versioning. - ALWAYS enforce subject line length limit (72 characters) — subjects
Установить commit-validator в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepBashВложенные файлы
FAQ
Что делает скилл 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.
Как установить скилл commit-validator?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл commit-validator запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic