← ClaudeAtlas

hooks-configurationlisted

Claude Code hooks creation and debugging assistant. Configures PreToolUse, PostToolUse, Stop, SessionStart, UserPromptSubmit, and other lifecycle hooks in settings.json. Creates command hooks (Bash/Python scripts), prompt-based hooks (LLM evaluation), and agent hooks. Handles exit codes (0=allow, 1=error, 2=deny), matchers, async execution, and security enforcement patterns. Use when creating a hook, debugging a hook, blocking dangerous commands, auto-formatting on save, running tests on stop, or adding session logging.
seanwinslow28/code-brain · ★ 0 · AI & Automation · score 72
Install: claude install-skill seanwinslow28/code-brain
# Hooks Configuration ## Purpose Create, configure, and debug Claude Code hooks that enforce security policies, automate quality checks, and inject context at precise points in the agentic loop. Hooks are deterministic -- they always execute, unlike skills which rely on model judgment. ## When to Use - Creating a PreToolUse hook to block dangerous commands or sensitive file access - Setting up PostToolUse hooks for auto-formatting or logging - Adding a Stop hook to run tests before Claude yields control - Configuring SessionStart hooks to inject project context - Debugging a hook that is not firing or is causing errors - Choosing between command hooks, prompt hooks, and agent hooks ## Examples **Example 1: Block secrets access** ``` User: "Create a hook that prevents Claude from reading .env files" Claude: [Uses hooks-configuration] Creates .claude/hooks/block-secrets.py: import sys, json data = json.load(sys.stdin) path = data.get('tool_input', {}).get('file_path', '') if '.env' in path or 'secrets' in path: print(f"ACCESS DENIED: '{path}' contains secrets.", file=sys.stderr) sys.exit(2) sys.exit(0) Adds to .claude/settings.json: "PreToolUse": [{"matcher": "Read|Edit|Write", "hooks": [{"type": "command", "command": "python3 .claude/hooks/block-secrets.py"}]}] ``` **Example 2: Auto-format Python files** ``` User: "Run ruff format every time Claude edits a Python file" Claude: [Uses hooks-configuration] Configures a PostToolUse hook with matcher "Edit|Write" t