# Hook Development > This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API. Source: https://skillsagentes.com/skills/anthropics/claude-code/hook-development Repository: https://github.com/anthropics/claude-code Author: anthropics License: not specified Updated: hace 9 meses Context cost: 131 tok installed, 4.1k tok once triggered, 16.1k tok with every bundled file Bundle: 11 files, 63 KB Permissions requested: none declared ## Install ```bash npx -y skills add anthropics/claude-code --skill hook-development --agent claude-code ``` ## What it does - Configura hooks de eventos en `hooks/hooks.json` para validar, modificar o reaccionar a acciones de Claude Code - Implementa hooks basados en prompt (LLM) o en comandos bash para eventos como PreToolUse, Stop, SessionStart - Define matchers, formatos de salida JSON, códigos de salida y variables de entorno como `${CLAUDE_PLUGIN_ROOT}` - Aplica buenas prácticas de seguridad: validación de entradas, prevención de path traversal, comillas en variables bash ## Use it when - El usuario pide crear un hook o añadir un hook PreToolUse/PostToolUse/Stop - Se necesita validar el uso de herramientas o bloquear comandos peligrosos - Se quiere usar `${CLAUDE_PLUGIN_ROOT}` o configurar automatización basada en eventos - Se menciona algún evento de hook (SessionStart, UserPromptSubmit, PreCompact, Notification, etc.) ## What triggers it - "Crea un hook PreToolUse que valide escrituras de archivos" - "Añade un hook Stop que verifique que las pruebas pasaron antes de terminar" - "Configura un hook SessionStart que cargue contexto del proyecto" - "Necesito bloquear comandos bash peligrosos con un hook" ## Before you install - Requiere `jq` para procesar JSON en hooks de comando y familiaridad con `hooks/hooks.json` del plugin. - Needs on PATH: jq - Environment: CLAUDE_ENV_FILE, CLAUDE_PLUGIN_ROOT, CLAUDE_PROJECT_DIR, CONFIG_FILE, FLAG_FILE, HOOKS_FILE, HOOK_SCRIPT, TEST_INPUT, TIMEOUT, TOOL_INPUT, VALID_EVENTS, VERBOSE ## Files - SKILL.md — 16 KB - examples/load-context.sh — 2 KB - examples/validate-bash.sh — 1 KB - examples/validate-write.sh — 1 KB - references/advanced.md — 10 KB - references/migration.md — 8 KB - references/patterns.md — 7 KB - scripts/README.md — 4 KB - scripts/hook-linter.sh — 4 KB - scripts/test-hook.sh — 5 KB - scripts/validate-hook-schema.sh — 5 KB ## SKILL.md Not reproduced here. Read it at https://github.com/anthropics/claude-code/blob/main/plugins/plugin-dev/skills/hook-development/SKILL.md --- Skills Agentes — https://skillsagentes.com/skills/anthropics/claude-code/hook-development