# Install Hooks > Instala o repara hooks que revisan la presencia de secretos en cada commit, push o acción de un asistente de IA; usa scan-secrets para un escaneo puntual o una investigación de fuga. Fuente: https://skillsagentes.com/skills/gitguardian/agent-skills/install-hooks Markdown: https://skillsagentes.com/skills/gitguardian/agent-skills/install-hooks.md Repositorio: https://github.com/GitGuardian/agent-skills Autor: GitGuardian Licencia: MIT Actualizado: hace 10 días Coste de contexto: 77 tok instalada, 1k tok al activarse, 12.6k tok con todos los archivos del bundle Bundle: 12 archivos, 49 KB Permisos que pide: ninguno declarado ## Instalación Un skill son archivos markdown: los mismos archivos valen para cualquier agente y lo único que cambia es el directorio de destino, es decir la bandera `--agent`. Añade `-g` para instalarlo en todos los proyectos de la máquina. ```bash # Claude Code npx -y skills add GitGuardian/agent-skills --skill install-hooks --agent claude-code # Cursor npx -y skills add GitGuardian/agent-skills --skill install-hooks --agent cursor # Codex npx -y skills add GitGuardian/agent-skills --skill install-hooks --agent codex # Gemini CLI npx -y skills add GitGuardian/agent-skills --skill install-hooks --agent gemini # Windsurf npx -y skills add GitGuardian/agent-skills --skill install-hooks --agent windsurf # Cline npx -y skills add GitGuardian/agent-skills --skill install-hooks --agent cline ``` ## Qué hace - Instala o repara hooks de Git (pre-commit, pre-push) o de asistentes de IA que escanean en busca de secretos - Comprueba qué protección ya existe antes de instalar nada, para no duplicar hooks - Tras instalar, verifica la configuración pero no ejecuta un escaneo de prueba - Al encontrar un secreto en un hook, informa del tipo y la ubicación sin mostrar el valor ## Cuándo usarla - El usuario quiere prevenir fugas de secretos en commits, pushes o acciones de un asistente de IA - Hay trabajo con credenciales sin protección de hooks - Un escaneo del agente duplica un hook que ya existe - El usuario pide explícitamente instalar o reparar hooks ## Cuándo no - Para un escaneo puntual o una investigación de una fuga, usa scan-secrets en su lugar ## Qué la activa - "Instala un hook de pre-commit para detectar secretos" - "Repara la protección de secretos en este repo" - "Quiero que se revisen los prompts de mi asistente de IA antes de ejecutarse" - "Añade un hook de pre-push que escanee commits salientes" ## Antes de instalar - Necesitas el CLI ggshield instalado y autenticado (v1.49.0+ para hooks de asistentes de IA, v1.51.0+ para codex), además de git o la herramienta de IA correspondiente. ## Archivos - SKILL.md — 4 KB - evals/evals.json — 10 KB - evals/files/README.md — 4 KB - evals/files/already-has-hook/setup.sh — 2 KB - evals/files/ambiguous-asks-family/setup.sh — 951 B - evals/files/global-needs-consent/setup.sh — 1 KB - evals/files/install-claude-code/setup.sh — 1 KB - evals/files/install-precommit-local/setup.sh — 1 KB - evals/targets.json — 81 B - references/ggshield-cli-setup.md — 14 KB - references/gitguardian-platform.md — 6 KB - references/hook-selection.md — 6 KB ## SKILL.md Reproducido tal cual desde GitGuardian/agent-skills bajo MIT. Esta sección es el documento original y está en inglés. # Install secret-scanning hooks ## Overview Hooks do the recurring checks. The agent does not. Never run a scan yourself, and never write a script or other tool to find secrets. Check the existing protection once per context. Reuse protection that works. Offer a missing installation or a repair one time. If the user declines, do not ask again, and do not run scans instead. ## When to Use | Requested protection | Hook | Content that the hook checks | |---|---|---| | Before a commit | `pre-commit` | Staged changes | | Before a push | `pre-push` | Outgoing commits, including intermediate versions | | During AI assistant actions | AI hook for the named or active assistant | Supported prompt and tool events | Use the stage, the assistant, and the scope that the user specified. Ask only for a missing choice. For a bare "install hooks" request, ask which hook family the user wants. An explicit installation request authorizes its stated scope. A recommendation request or a scan request does not authorize an installation. A global installation needs explicit authorization. ## Onboarding (first use) ### Prerequisites Before an installation, check: - `ggshield --version` - the `--help` output of the relevant command - `ggshield api-status` for authentication - the target assistant, when the request names one Do not repeat a check that already passed in this context. ### Setup If the CLI is missing or not authenticated, read [ggshield-cli-setup.md](references/ggshield-cli-setup.md). Otherwise, continue. ## Commands Read the relevant section of [hook-selection.md](references/hook-selection.md) when you check, install, or repair protection. It covers the effective Git hook paths, existing hook managers, and scoped AI hook installation. Do not read it again for a routine operation that it already covered. After an installation, check the configuration. Do not run a test scan. Do not create a test secret, a test commit, or a test push. Report "configured" and "ran and passed" as two different states. The next authorized operation runs the hook and gives the "ran and passed" result. ## Best Practices - Keep existing hook managers and existing secret protection. A hook that only runs a linter is not secret protection. - Do not add manual scans next to a hook. Do not bypass a hook failure. Do not report a skipped or failed check as clean. For an explicit scan, use `scan-secrets` when it is available. - When a hook finds a secret, report the secret type and location. Do not show the secret value. Show the organization's remediation message first, when one exists. Determine if the secret was exposed. A blocked commit or push does not prove that the secret never leaked elsewhere. If the secret is only local, remove it, including from unpushed commits. If the secret was exposed, coordinate a rotation. The same hook checks the next authorized retry. If `scan-secrets` is installed, it contains detailed remediation guidance. ## Troubleshooting If a hook does not run, check the effective hook paths, the hook manager dispatch, the enabled events, the authentication, and the project trust settings. The hook-selection reference describes each check. An AI scan error can let an unscanned action continue. To uninstall, remove only the ggshield entries, through the hook manager that owns them. Keep the other hooks. ## Dónde encaja - Categoría: [Seguridad](https://skillsagentes.com/categorias/seguridad.md) — Auditorías, revisión de dependencias, manejo de secretos y modelado de amenazas. - Creador: [GitGuardian](https://skillsagentes.com/creators/gitguardian.md) — 6 skills en el directorio - [Todas las skills](https://skillsagentes.com/skills.md) - [Ranking de instalaciones](https://skillsagentes.com/ranking.md) ## Otras skills del mismo repositorio - [Triage Incidents](https://skillsagentes.com/skills/gitguardian/agent-skills/triage-incidents.md): Para triar incidentes de secretos de GitGuardian ya detectados, ver qué se filtra o rotar credenciales marcadas, o tras una alerta de Public Monitoring. Funciona vía el servidor GitGuardian Developer MCP. - [Scan Secrets](https://skillsagentes.com/skills/gitguardian/agent-skills/scan-secrets.md): Escanea ficheros, cambios staged, commits, historial, imágenes Docker o paquetes en busca de secretos codificados, ante una petición de escaneo, auditoría o filtración sospechosa. - [Create Honeytokens](https://skillsagentes.com/skills/gitguardian/agent-skills/create-honeytokens.md): Úsalo al generar o plantar honeytokens, canary tokens, decoys o tripwire credentials de GitGuardian en .env.example, configs de ejemplo, repos antes de publicarse, wikis o scripts de deploy. - [Check Hmsl](https://skillsagentes.com/skills/gitguardian/agent-skills/check-hmsl.md): Comprueba si una credencial conocida ya se filtró públicamente mediante HasMySecretLeaked (HMSL) de GitGuardian; el agente solo prepara comandos, el usuario los ejecuta. - [Scan Machine](https://skillsagentes.com/skills/gitguardian/agent-skills/scan-machine.md): Escanea todo el equipo de un desarrollador en busca de credenciales (repos, dotfiles, configs de AWS/kube/docker/npm, historial de shell, cachés de agentes IA) con ggshield machine scan. ## Skills relacionadas - [Check Hmsl](https://skillsagentes.com/skills/gitguardian/agent-skills/check-hmsl.md): Comprueba si una credencial conocida ya se filtró públicamente mediante HasMySecretLeaked (HMSL) de GitGuardian; el agente solo prepara comandos, el usuario los ejecuta. - [Create Honeytokens](https://skillsagentes.com/skills/gitguardian/agent-skills/create-honeytokens.md): Úsalo al generar o plantar honeytokens, canary tokens, decoys o tripwire credentials de GitGuardian en .env.example, configs de ejemplo, repos antes de publicarse, wikis o scripts de deploy. - [Scan Machine](https://skillsagentes.com/skills/gitguardian/agent-skills/scan-machine.md): Escanea todo el equipo de un desarrollador en busca de credenciales (repos, dotfiles, configs de AWS/kube/docker/npm, historial de shell, cachés de agentes IA) con ggshield machine scan. - [Scan Secrets](https://skillsagentes.com/skills/gitguardian/agent-skills/scan-secrets.md): Escanea ficheros, cambios staged, commits, historial, imágenes Docker o paquetes en busca de secretos codificados, ante una petición de escaneo, auditoría o filtración sospechosa. - [Triage Incidents](https://skillsagentes.com/skills/gitguardian/agent-skills/triage-incidents.md): Para triar incidentes de secretos de GitGuardian ya detectados, ver qué se filtra o rotar credenciales marcadas, o tras una alerta de Public Monitoring. Funciona vía el servidor GitGuardian Developer MCP. --- Skills Agentes · [Índice de páginas en markdown](https://skillsagentes.com/sitemap.md) · [Inicio](https://skillsagentes.com/index.md)