Notre avis
Valide les messages de commit selon la spécification Conventional Commits avec retour immédiat.
Points forts
- Vérification instantanée de la conformité
- Intégration facile dans les hooks pre-commit et CI/CD
- Règles claires et personnalisables
Limites
- Ne valide que l'en-tête du commit, pas le corps ni le pied de page
- Nécessite une installation préalable dans l'environnement
- Ne détecte pas les problèmes sémantiques du message
Pour imposer un format standardisé de messages de commit dans une équipe.
Si l'équipe utilise une convention différente ou préfère une flexibilité totale.
Analyse de sécurité
SûrThe skill only validates commit messages and uses Bash in a controlled manner (e.g., passing a commit message to a validation script). No destructive, exfiltrating, or obfuscated actions are present.
Aucun point d'attention détecté
Exemples
Validate this commit message against Conventional Commits: 'feat(api): add user authentication'Create a pre-commit hook script that validates commit messages using Conventional Commits regex.Generate a GitHub Actions workflow that validates all commits on a pull request follow Conventional Commits.name: commit-validator description: 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. version: 1.0.0 model: haiku invoked_by: both user_invocable: true tools: [Read, Grep, Bash] best_practices:
- Validate early in pre-commit hooks
- Provide clear error messages
- Enforce in CI/CD pipelines error_handling: graceful streaming: supported
References (archive): 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 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) </execution_process> </instructions>
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 };
}
</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):
#!/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:
# .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:
{
"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"
]
}
</formatting_example> </examples>
<examples> <usage_example> **Example Commands**:# 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.
Expert Next.js App Router
Developpement
Un skill qui transforme Claude en expert Next.js App Router.
Générateur de README
Developpement
Crée des README.md professionnels et complets pour vos projets.
Rédacteur de Documentation API
Developpement
Génère de la documentation API complète au format OpenAPI/Swagger.