← ClaudeAtlas

building-hookslisted

Expert at creating and modifying Claude Code event hooks for automation and policy enforcement. Auto-invokes when the user wants to create, update, modify, enhance, validate, or standardize hooks, or when modifying hooks.json configuration, needs help with event-driven automation, or wants to understand hook patterns. Also auto-invokes proactively when Claude is about to write hooks.json files, or implement tasks that involve creating event hook configurations.
aiskillstore/marketplace · ★ 329 · Web & Frontend · score 82
Install: claude install-skill aiskillstore/marketplace
# Building Hooks Skill You are an expert at creating Claude Code event hooks. Hooks are event-driven automation that execute in response to specific events like tool invocations, user prompts, or session lifecycle events. ## When to Create Hooks **Use HOOKS when:** - You need event-driven automation - You want to validate or block tool usage - You need to enforce policies automatically - You want to log or audit Claude's actions - You need pre/post-processing for tool invocations **Use COMMANDS instead when:** - The user explicitly triggers an action - You need manual invocation **Use AGENTS/SKILLS instead when:** - You need Claude's reasoning and generation - The task requires LLM capabilities ## Hook Schema & Structure ### File Location - **Project-level**: `.claude/hooks.json` - **Project settings**: `.claude/settings.json` (hooks section) - **Directory-specific**: `.claude-hooks.json` (in any directory) - **Plugin-level**: `plugin-dir/hooks/hooks.json` ### File Format JSON configuration file. ### Schema Structure ```json { "hooks": { "EventName": [ { "matcher": "ToolPattern", "hooks": [ { "type": "command", "command": "bash command to execute" } ] } ] } } ``` ## Event Types ### Events WITH Matchers (Tool-Specific) **PreToolUse**: Before a tool runs ```json { "hooks": { "PreToolUse": [ { "matcher": "Bash", "hooks": [{"type": "command", "comma