pre-push-guard
Skill1 starsChanged 11 days agoMITView on GitHub
Orquestador que corre los validadores del toolkit sobre los archivos del diff (vs `origin/<branch>`) antes de un `git push` — encadena yaml-control sobre los `*.y*ml` modificados, md-lint-fix en modo check sobre los `*.md` modificados, y `pytest` si el diff toca `.py` y existe `tests/`. Aborta el push (exit 1) si algún paso falla, con un reporte unificado en stdout. Úsalo cuando el usuario diga "valida antes de pushear", "chequea todo antes del push", "pre-push", "guard antes de push", "corre todos los checks", "lint completo antes de subir", o proactivamente justo antes de invocar `git push`. Soporta `--install-hook` para registrarlo como git pre-push hook (opt-in, nunca automático). Trabaja sobre `Path.cwd()`.
- Installs packages
- Commits and pushes
2 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- thejaustin/ShizukuPlustheir own version, first seen Oct 8, 2026
- vladimiracunadev-create/codex-skills-toolkitedited, first seen Sep 8, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- vladimiracunadev-create/codex-skills-toolkit★ 090% same
Wrote their own version · 1
- thejaustin/ShizukuPlus★ 1.7ksame name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository22 other files it gives its agents.
- bitcoin-custody-auditSkill
- clone-repoSkill
- docker-cleanupSkill
- docker-compose-doctorSkill
- functional-user-flow-testerSkill
- git-pushSkill
- md-lint-fixSkill
- md-to-docSkill
- pre-commit-guardSkill
- preliminary-product-testerSkill
- python-deps-pinningSkill
- python-lint-guardSkill
- python-version-controlSkill
- release-evidence-auditorSkill
- repo-coherence-auditSkill
- security-auditSkill
- software-resilience-state-testerSkill
- sync-forkSkill
- nombre-del-skillSkill
- version-bumpSkill
- web-snapSkill
- yaml-controlSkill
The file
Files
pre-push-guard
Un único comando que ejecuta toda la suite de validación local del toolkit sobre los archivos modificados — para evitar que llegue a CI un push que ya se sabía roto.
Es un orquestador: no duplica lógica de [[yaml-control]], [[md-lint-fix]] ni de los tests. Los invoca en orden, sobre el diff real (git diff --name-only origin/<branch>...HEAD + working tree), y agrega los resultados.
Alcance y permisos
| Capacidades del script | shell · file_write |
| Qué toca | Lee el diff contra origin/<rama>, invoca yaml-control, md-lint-fix y pytest, y con --install-hook escribe .git/hooks/pre-push. |
| Qué nunca toca | No instala el hook por su cuenta: --install-hook es opt-in, y respalda el hook previo antes de sobreescribirlo. |
| Herramientas retiradas | WebFetch, WebSearch |
No declara allowed-tools, y es deliberado: ese campo preaprueba herramientas —se salta la confirmación durante el turno que invoca el skill— en vez de limitarlas. Declararlo aquí no acotaría nada: quitaría la confirmación del usuario. disallowed-tools sí retira herramientas del pool mientras el skill está activo, y ahí es donde se acota de verdad.
Escribe en .git/hooks/.
Cuándo invocar este skill
Triggers explícitos:
- "valida antes de pushear"
- "chequea todo antes del push"
- "pre-push"
- "guard antes de push"
- "corre todos los checks"
- "lint completo antes de subir"
Triggers proactivos:
- Justo antes de ejecutar
git pushcuando hay cambios sin pushear. - Cuando el usuario menciona que "CI estuvo rojo por X" y X es lint/tests — invocar pre-push-guard antes del siguiente push.
Cómo se invoca
python ~/.claude/skills/pre-push-guard/pre_push_guard.pyModos:
# Todos los archivos rastreados (no solo el diff)
python .../pre_push_guard.py --all
# Saltar tests (solo lint)
python .../pre_push_guard.py --no-tests
# Saltar lint (solo tests)
python .../pre_push_guard.py --no-lint
# Output JSON
python .../pre_push_guard.py --json
# Instalar como git hook (opt-in)
python .../pre_push_guard.py --install-hook
# Desinstalar el hook
python .../pre_push_guard.py --uninstall-hookImportante: el hook NO se instala automáticamente. Hay que pasar --install-hook explícitamente.
Exit codes:
0— todos los checks pasaron.1— al menos un check falló → bloquea el push.2— error de invocación (no es un repo git, etc.).
Qué hace exactamente, en orden
1. Detecta el diff:
git diff --name-only origin/<current-branch>...HEAD
+ git diff --name-only HEAD (cambios staged + unstaged)
+ git ls-files --others --exclude-standard (archivos nuevos)
2. Particiona el diff por extensión:
- *.yml / *.yaml → yaml-control
- *.md → md-lint-fix --check
- *.py → trigger para pytest si existe tests/
3. Ejecuta los pasos en orden, abortando al primer error:
[a] yaml-control sobre los YAML del diff
[b] md-lint-fix --check sobre los .md del diff (no auto-fix — solo reporta)
[c] pytest si hay .py en el diff y existe tests/
4. Reporta resumen unificado con:
- cuántos archivos vio cada step
- cuánto tardó cada uno
- qué falló y cómo arreglarloQué NO hace / limitaciones
- No hace auto-fix. Por diseño — la idea es bloquear, no modificar. Si quieres auto-fix de markdown, corre
md-lint-fixpor separado antes. - No instala dependencias. Si
pytestno está en el entorno y hay.pyen el diff, te avisa y aborta. No instala silenciosamente nada. - No reemplaza CI. Es un pre-flight check, no la verdad. CI sigue siendo la fuente de verdad.
- No corre security-audit. Audit es pesado y opt-in. Si quieres incluirlo, invócalo a mano.
- El hook git ignora
--no-tests/--no-lint. El hook siempre corre la suite completa — esos flags solo aplican a invocación manual.
Dependencias
| Dependencia | Cómo instalar | Requerida o opcional |
python>=3.11 | viene con el SO | requerida |
git | sistema | requerida |
~/.claude/skills/yaml-control/ | parte del toolkit | opcional (si falta, salta capa YAML) |
~/.claude/skills/md-lint-fix/ | parte del toolkit | opcional (si falta, salta capa MD) |
pytest | pip install pytest | opcional (si falta y hay .py, avisa) |
Si los skills hermanos no están instalados, pre-push-guard degrada con un warning explícito — no falla.
Ejemplos de salida
Caso OK
pre-push-guard — repo: C:/dev/claude-skills-toolkit
rama: main · base: origin/main
diff: 4 archivos (.github/workflows/ci.yml, README.md, skills/foo/main.py, tests/test_foo.py)
[1/3] yaml-control · 1 archivo
✓ .github/workflows/ci.yml
(0.8s)
[2/3] md-lint-fix --check · 1 archivo
✓ README.md
(0.3s)
[3/3] pytest · 8 tests
✓ 8 passed
(1.2s)
✅ Todo verde. OK para `git push` (2.3s total).Exit 0.
Caso con falla
pre-push-guard — repo: C:/dev/foo
rama: feat/auth · base: origin/main
diff: 3 archivos (compose.yml, src/auth.py, tests/test_auth.py)
[1/3] yaml-control · 1 archivo
✗ compose.yml — sintaxis YAML inválida (línea 14)
(0.4s)
❌ Bloqueado en step [1/3]. Arregla y vuelve a intentar.
Detalles arriba ↑Exit 1. No corre los pasos siguientes — fail-fast.
Instalación como git hook
cd /tu/repo
python ~/.claude/skills/pre-push-guard/pre_push_guard.py --install-hookEsto crea .git/hooks/pre-push (o lo respalda si ya existe como .pre-push.bak). El hook llama al skill antes de cada git push. Si falla, el push se aborta.
Para desinstalar:
python ~/.claude/skills/pre-push-guard/pre_push_guard.py --uninstall-hookRestaura el backup si existe; si no, elimina el hook.
El hook se puede saltar con git push --no-verify (estándar de git) en caso de emergencia.
Integración con otros skills
[[yaml-control]] — la capa 1
[[md-lint-fix]] — la capa 2 (modo check)
[[security-audit]] — NO incluido (demasiado pesado para pre-push)Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

