Commit Conventions Skill¶
Tu es mainteneur de code source, orienté traçabilité et historique propre.
Mission¶
Garantir que chaque commit respecte le format Conventional Commits, permettant la génération automatique de changelogs et la traçabilité des changements.
Format obligatoire¶
Structure détaillée¶
feat(documents): Add PRE support for document sharing
Implement Proxy Re-Encryption (AFGH scheme) to enable secure
document sharing between users without server-side decryption.
- Add PRE key generation in CryptoService
- Implement re-encryption endpoint in DocumentsController
- Add CloudHSM integration for PRE operations
- Add tests for PRE key derivation
Refs: PD-42
Breaking-Change: /api/v1/documents/share now requires re_key parameter
Types obligatoires¶
| Type | Description | Exemples |
|---|---|---|
feat | Nouvelle fonctionnalité | feat(auth): Add biometric authentication |
fix | Correction de bug | fix(crypto): Fix key derivation race condition |
docs | Documentation seule | docs(api): Update authentication flow diagram |
style | Formatage, indentation | style(components): Fix ESLint warnings |
refactor | Refactoring sans changement fonctionnel | refactor(services): Extract crypto utils |
perf | Amélioration de performance | perf(crypto): Optimize AES-GCM encryption |
test | Ajout/modification de tests | test(documents): Add tests for PRE |
build | Système de build | build(deps): Upgrade @noble/hashes to 1.3.0 |
ci | CI/CD | ci(gitlab): Add FIPS compliance check |
chore | Maintenance générale | chore(scripts): Update sync-docs.sh |
revert | Annulation d'un commit | revert: feat(auth): Revert biometric auth |
Scopes recommandés¶
Backend (ProbatioVault-backend)¶
auth: Authentificationcrypto: Cryptographiedocuments: Gestion documentsusers: Gestion utilisateursvaults: Gestion des vaultspre: Proxy Re-Encryptionhsm: CloudHSM integrationapi: API endpointsdatabase: Schéma/migrationsconfig: Configuration
App (ProbatioVault-app)¶
auth: Écrans d'authentificationdocuments: Écrans documentscrypto: Crypto client-sidebiometric: Biométrie (Face ID, Touch ID)navigation: Navigationcomponents: Composants UIscreens: Écransservices: Services métierstorage: Secure storage
Infra (ProbatioVault-infra)¶
terraform: Infrastructure as Codeaws: Services AWScloudhsm: CloudHSMnetworking: VPC, subnets, etc.monitoring: CloudWatch, logssecurity: Security groups, IAMscripts: Scripts automation
IA Governance (ProbatioVault-ia-governance)¶
agents: Spécifications agentsskills: Skills Claude Codeworkflow: Workflow IAtemplates: Templates docsprompts: Prompts IA
Règles de description¶
Format de la description¶
Règles : - ✅ Impératif présent : "Add feature", "Fix bug" - ❌ Pas de passé : "Added feature", "Fixed bug" - ✅ Minuscule (sauf noms propres) : "add", "fix", "update" - ❌ Pas de majuscule initiale (sauf noms propres) - ✅ Max 72 caractères pour la première ligne - ❌ Pas de point final
Exemples corrects¶
feat(crypto): Add SHA3-256 support for document hashing
fix(auth): Fix race condition in token refresh
docs(api): Update PRE endpoint documentation
perf(documents): Optimize encryption performance by 2x
test(crypto): Add FIPS test vectors validation
refactor(services): Extract HSM operations to dedicated service
Exemples incorrects¶
# ❌ Pas d'impératif
feat(crypto): Added SHA3-256 support
# ❌ Majuscule
feat(crypto): Add SHA3-256 Support
# ❌ Point final
feat(crypto): Add SHA3-256 support.
# ❌ Trop vague
fix: bug fix
# ❌ Pas de type
crypto: Add SHA3-256 support
# ❌ Trop long (> 72 chars)
feat(crypto): Add SHA3-256 support for document hashing with FIPS 202 compliance and test vectors validation
Body du commit (optionnel)¶
Le body doit : - Expliquer le pourquoi, pas le quoi (le quoi est dans le code) - Être séparé de la description par une ligne vide - Utiliser des paragraphes de 72 caractères max par ligne - Lister les changements avec des bullet points si plusieurs
Exemple avec body¶
fix(crypto): Fix key derivation race condition
When multiple documents were uploaded simultaneously, the key derivation
function was called concurrently with the same parameters, causing
occasional key collision.
- Add mutex lock around key derivation
- Add unit tests for concurrent key derivation
- Add stress test with 100 parallel uploads
Refs: PD-XX
Footer du commit (optionnel mais recommandé)¶
Breaking Changes¶
OBLIGATOIRE si le commit introduit un breaking change.
feat(api): Change authentication endpoint format
BREAKING CHANGE: /api/v1/auth/login now requires email field instead of username.
Migration: Update all API clients to use email field.
Références¶
Toujours référencer la PD associée si applicable.
Co-Authored-By (IA)¶
OBLIGATOIRE pour les commits générés par IA.
feat(documents): Implement document encryption
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Commits spéciaux¶
Merge commits¶
# ✅ CORRECT
merge: Merge branch 'feat/pre-support' into dev
# ✅ CORRECT (auto-generated)
Merge branch 'feat/pre-support' into 'dev'
Revert commits¶
# ✅ CORRECT
revert: feat(auth): Revert biometric authentication
This reverts commit a1b2c3d4.
Reason: Face ID integration causes crashes on iOS 15.
Release commits¶
# ✅ CORRECT
chore(release): Release v1.2.0
- PRE support
- CloudHSM integration
- Performance improvements
Règles pour multi-fichiers¶
Un commit = un changement logique¶
# ❌ INCORRECT - Mélange de types
git commit -m "feat(crypto): Add SHA3-256 and fix typo in README"
# ✅ CORRECT - Séparé
git commit -m "feat(crypto): Add SHA3-256 support for document hashing"
git commit -m "docs(readme): Fix typo in installation section"
Exceptions : changements liés¶
# ✅ CORRECT - Changements liés (feature + tests)
feat(crypto): Add SHA3-256 support for document hashing
- Implement sha3_256 wrapper in CryptoService
- Add FIPS 202 test vectors validation
- Update CryptoModule configuration
Validation automatique¶
Pre-commit hook¶
#!/bin/bash
# .git/hooks/commit-msg
commit_msg_file=$1
commit_msg=$(cat "$commit_msg_file")
# Regex conventional commits
pattern="^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?: .{1,72}$"
if ! echo "$commit_msg" | head -n1 | grep -qE "$pattern"; then
echo "❌ Commit message does not follow Conventional Commits format"
echo ""
echo "Format: <type>(<scope>): <description>"
echo ""
echo "Example: feat(crypto): Add SHA3-256 support"
exit 1
fi
Commitlint (recommandé)¶
npm install --save-dev @commitlint/cli @commitlint/config-conventional
# commitlint.config.js
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [2, 'always', [
'feat', 'fix', 'docs', 'style', 'refactor',
'perf', 'test', 'build', 'ci', 'chore', 'revert'
]],
'subject-case': [2, 'always', 'lower-case'],
'subject-full-stop': [2, 'never', '.'],
'header-max-length': [2, 'always', 72]
}
};
Génération de changelog¶
Les commits conventional permettent la génération automatique.
# Générer CHANGELOG.md
npx conventional-changelog -p angular -i CHANGELOG.md -s
# Exemple de changelog généré
## [1.2.0] - 2026-01-14
### Features
- **crypto**: Add SHA3-256 support for document hashing (#42)
- **pre**: Implement Proxy Re-Encryption for sharing (#45)
### Bug Fixes
- **auth**: Fix race condition in token refresh (#48)
### Performance
- **crypto**: Optimize AES-GCM encryption by 2x (#50)
Checklist avant commit¶
- Type correct (feat, fix, docs, etc.)
- Scope pertinent au changement
- Description en impératif présent
- Description < 72 caractères
- Pas de point final
- Body explique le "pourquoi" si nécessaire
- Breaking change documenté si applicable
- Référence PD-XX si applicable
- Co-Authored-By si commit IA
Exemples complets (ProbatioVault)¶
Feature avec breaking change¶
feat(api): Change document upload endpoint format
The previous format did not support metadata and versioning.
New format includes doc_version and metadata fields.
- Add doc_version field (required)
- Add metadata field (optional)
- Update API documentation
- Add migration script for existing documents
BREAKING CHANGE: /api/v1/documents/upload now requires doc_version field.
Migration guide: https://docs.probatiovault.com/migration/v1.2.0
Refs: PD-42
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Fix de sécurité¶
fix(crypto): Fix timing attack vulnerability in authentication
The previous implementation used string comparison which is vulnerable
to timing attacks, allowing attackers to deduce token validity.
- Replace string comparison with constant-time comparison
- Add timing attack tests
- Update security documentation
Refs: PD-XX, CVE-2026-XXXXX
Refactoring¶
refactor(services): Extract crypto operations to dedicated service
CryptoService was growing too large (> 1000 lines) and mixing concerns.
- Extract hash operations to HashService
- Extract key derivation to KeyDerivationService
- Extract encryption to EncryptionService
- Update all imports
- No functional changes
Refs: PD-XX
Escalade¶
Escalader vers Agent Documentation Maintainer si : - Difficulté à générer le changelog automatiquement - Commits non-conformes nombreux dans l'historique - Besoin de réécriture d'historique (rebase interactif)
Références¶
- Conventional Commits: https://www.conventionalcommits.org/
- Commitlint: https://commitlint.js.org/
- Conventional Changelog: https://github.com/conventional-changelog/conventional-changelog
Historique¶
| Version | Date | Changement |
|---|---|---|
| 1.0.0 | 2026-01-14 | Création initiale |