commit
Crea un commit con conventional commits y verificaciones previas (secretos, build, mensaje).
Ficha técnica
| disable-model-invocation | true |
|---|---|
| allowed-tools | Read, Grep, Glob, Bash(git *) |
Activación
Solo el usuario la lanza con /hv:commit: lleva disable-model-invocation: true, así que el modelo no puede invocarla ni su descripción entra en contexto (cuesta 0 tokens hasta que se usa).
Ficheros del pack 1
- references/
- config-y-flujo.md 2375 B
Contenido
Solo usuario: lleva
disable-model-invocation: true, asi que el modelo NO puede lanzarla por su cuenta ni su descripcion entra en contexto. Se ejecuta unicamente cuando la invocas con/hv:commit. Es un workflow con efectos: hace staging y crea el commit.
El conocimiento va aparte: la convencion de mensajes NO se repite aqui. Vive en la skill
git-best-practices->patterns/conventional-commits.md(tipos, scopes, breaking changes, ejemplos). Este fichero es el procedimiento; esa skill es el porque.
Configuracion y diagrama de flujo:
references/config-y-flujo.md.
1. Flujo de commit (Git)
2.1 Show pending changes
git status --short
git diff --stat
2.2 Selective staging
⚠️ Never git add all
git add -AGit add all risk
# ✅ Staging selectivo - solo archivos relevantes
git add src/Controllers/ScholarshipsController.cs
git add src/Services/ScholarshipService.cs
git add tests/ScholarshipServiceTests.cs
# ✅ Staging por directorio
git add src/Features/Scholarships/
# ✅ Staging interactivo (revisar cambio por cambio)
git add -p
# ❌ NUNCA: git add -A (puede incluir .env, secrets, binarios)
# ❌ NUNCA: git add . (mismo problema)
Staging behavior:
| Nivel de integracion | Staging action |
|---|---|
| Level basic | Staging basic |
| Level medium | Staging medium |
| Level high | Staging high |
2.3 Secrets scan
🔒 Mandatory before commit
# Escanear archivos staged por patterns de secrets
git diff --cached --name-only | while read file; do
# Buscar patterns peligrosos
grep -nE "(password|secret|api[_-]?key|connectionstring|token)\s*[:=]" "$file" 2>/dev/null
done
Secrets patterns:
| Pattern | Riesgo | Ejemplo | |
|---|---|---|---|
password\s*[:=] | 🔴 Critico | password = "abc123" | |
| `(api[_-]?key\ | secret)\s*[:=]` | 🔴 Critico | apiKey = "sk-..." |
connectionstring.*password | 🔴 Critico | Server=prod;Password=... | |
-----BEGIN.*PRIVATE KEY | 🔴 Critico | Private key | |
Bearer [a-zA-Z0-9._-]{20,} | 🟠 Alto | Hardcoded token |
Secrets action:
🔴 SECRETS DETECTADOS - COMMIT BLOQUEADO
Secrets found in:
• src/appsettings.json:14 → password = "..."
• src/Services/ApiClient.cs:8 → apiKey = "sk-..."
Secrets options:
[1] Secrets exclude
[2] Secrets review
[3] Secrets abort
2.4 Pre commit checks
# 1. Verificar compilación (en src/)
Push-Location "src"
dotnet build --no-restore --verbosity quiet
Pop-Location
# 2. Invocar hooks existentes si están configurados
# Ver skill git-best-practices → tools/git-hooks-automation.md
Hooks check:
💡 No hooks detected
Hooks recommendation:
- pre-commit: build + format check
- commit-msg: Conventional Commits validation
Hooks install suggestion:
→ Ver skill git-best-practices → tools/git-hooks-automation.md
→ O ejecutar: .claude/skills/git-best-practices/templates/commit-msg-hook.sh.template
2.5 Build message
Build message intro:
📝 CONVENTIONAL COMMITS (v1.0)
Tipo:
1. feat - Type feat
2. fix - Type fix
3. refactor - Type refactor
4. docs - Type docs
5. test - Type test
6. chore - Type chore
7. perf - Type perf
8. style - Type style
9. ci - Type ci
10. build - Type build
11. revert - Type revert
Ambito (Opcional): api, auth, scholarships, domain, infrastructure, deps, ci...
Short description:
Breaking change (s/n):
2.6 Message validation
Validate before commit
^(feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert)(\(.+\))?(!)?: .{1,100}$
Validation examples:
| Mensaje | Valido | Razon |
|---|---|---|
feat(scholarships): añadir filtro por estado | ✅ | Valid format |
feat(api)!: cambiar formato respuesta | ✅ | Breaking format |
Fixed bug | ❌ | No type |
feat: a | ❌ | Too short |
update | ❌ | No conventional |
2.7 Breaking changes
Breaking changes intro:
# Opcion 1: Con "!" despues del tipo
feat(api)!: cambiar formato de respuesta paginada
# Opcion 2: Con BREAKING CHANGE en el footer
feat(api): cambiar formato de respuesta paginada
BREAKING CHANGE: PaginatedResult ahora usa TotalPages en lugar de TotalCount.
Los clientes deben actualizar sus modelos de respuesta.
2.8 Footer references
Footer intro:
# Cerrar ticket
feat(scholarships): implementar exportacion Excel
Closes: EV-18
# Azure DevOps Work Items
feat(scholarships): implementar exportacion Excel
AB#1234
# Multiples referencias
fix(auth): corregir refresh de token Azure AD
Fixes: HV-25
See also: HV-22, HV-24
Co-authored-by: Juan Garcia <jgarcia@example.com>
2.9 Associate evolutivo
El prefijo del commit tiene una sola fuente, y no es la convencion de ramas:
node .claude/hooks/config-check.js --resolve vcs.commitPrefix
Resuelve con la precedencia canonica (.claude/CONFIGURACION.md): configuracion.prefijoCommit del Hilo, vcs.commitPrefix de la organizacion, y por defecto [{codigo}]. Cadena vacia = sin prefijo, y entonces el mensaje empieza directamente por el tipo.
| Qué aporta | Quién |
|---|---|
| La forma del prefijo | vcs.commitPrefix |
Los valores de {codigo}, {tipo} y {fecha} | la rama actual, leida segun vcs.branchNamingConvention |
Un placeholder cuyo valor no se pueda sacar de la rama se omite con su separador, en vez de quedarse escrito: mas vale un prefijo corto que un [{codigo}] literal en el historial.
Nomenclatura semantica (feature/{codigo}-{descripcion}) con prefijo [{codigo}]:
Rama actual: feature/HV-05-paginacion
Mensaje: [HV-05] feat(api): Agregar paginación
Nomenclatura temporal (yyyyMMdd-{tipo}-{codigo}-{descripcion}) con prefijo [{fecha}-{tipo}-{codigo}]:
Rama actual: 20260406-EV-18-filter-scholarships
Mensaje: [20260406-EV-18] feat(scholarships): Agregar filter por estado
Sin prefijo (vcs.commitPrefix: ""):
Mensaje: feat(api): Agregar paginación
El prefijo es del proyecto, no de quien commitea: queda en el historial de git para siempre, asi que no hay clave personal que lo pise (ADR-082).
2.10 Signing reminder
Signing intro:
🔐 Signing detected
Signing method: SSH (Git 2.34+)
Signing key: ~/.ssh/id_ed25519.pub
Commit will be signed
→ Ver skill git-best-practices → patterns/ssh-signing.md
2.11 Execute commit
Execute by level:
| Nivel de integracion | Comportamiento |
|---|---|
| Level basic | Behavior basic |
| Level medium | Behavior medium |
| Level high | Behavior high |
# Staging selectivo (ya realizado en 2.2)
git commit -m "[HV-05] feat(api): Agregar paginación
Closes: HV-05"
4. Update context
Update context intro _hilo/HISTORIAL_CAMBIOS.md:
### [FECHA] - feat(api): Agregar paginación
- **Commit/Changeset**: [hash o pendiente de checkin]
- **Evolutivo**: HV-05
- **Archivos**: 5 archivos modificados
- **Firmado**: ✅ SSH / ❌ Sin firmar
**Cambios:**
- `ScholarshipsController.cs` - Añadido parámetros de paginación
- `GetScholarshipsQuery.cs` - Implementado paginación
5. Confirmation
Git:
✅ COMMIT EXITOSO
📝 Mensaje: [HV-05] feat(api): Agregar paginación
🔢 Hash: abc1234
📁 Archivos: 5 (staged selectivamente)
📋 Evolutivo: HV-05
🔐 Firmado: ✅ SSH
🔍 Secrets scan: ✅ No secrets found
✅ Validacion: Conventional Commits OK
💡 Siguiente paso: /git-sync Or manual git push
⚠️ Critical reminders
Siempre
- ✅ Always detect vcs
- ✅ Always scan secrets (2.3)
- ✅ Always selective staging (2.2)
- ✅ Always validate message (2.6)
- ✅ Always build (2.4)
- ✅ Always evolutivo
- ✅ Always conventional commits
- ✅ Always update historial
Nunca
- ❌
git add -A/git add .— Never git add all reason - ❌ Never commit without build
- ❌ Never generic messages ("cambios", "updates", "WIP")
- ❌ Never commit secrets
- ❌ Never skip validation
Skill integration
Skill integration intro git-best-practices:
| Recurso | Uso |
|---|---|
patterns/conventional-commits.md | Skill cc |
patterns/ssh-signing.md | Skill signing |
tools/git-hooks-automation.md | Skill hooks |
templates/commit-msg-hook.sh.template | Skill hook template |
checklists/pre-merge.md | Skill pre merge |
Skill commit · kind: workflow
Coste de contexto
Descripción de 92 caracteres (no se publica al modelo: workflow). Cuerpo: 550 palabras, se carga solo al activarse.
Historial
5 cambios · 2026-09-07 → 2026-09-23. Último cambio: feat(commit): el prefijo de commit lo aplica quien commitea (ADR-082) (a71a239).