Claude Code Hooks Guides and Tutorials
9 guides about Hooks, newest first. The first one published was “Claude Code Hooks Lifecycle: Every Event, Explained”. Last updated .
· 14 min read
Claude Code Hooks Not Working: 8 Fixes and a Debug Script
Claude Code hooks not working? Fix settings location, JSON, matchers, exit codes, permissions and claude -p, then log every payload with a debug script.
· 17 min read
Claude Code PreToolUse Hook: Copy-Paste Block Scripts
Claude Code PreToolUse hook guide: exact JSON input, allow/deny/ask output, exit codes, error fixes, copy-paste scripts that block risky headless runs.
· 17 min read
Claude Code Stop Hook: Block Early Exit Without Loops
Claude Code stop hook guide: block early exit until tests pass, cap retries with stop_hook_active and a counter, and fix JSON validation errors.
· 17 min read
AI Agent Monitoring in Claude Code: Catch Silent Failures
AI agent monitoring for solo builders: use Claude Code hooks, a cron wrapper and a free heartbeat check to catch silent failures without a monitoring stack.
· 17 min read
Claude Code Subagent allowed-tools: Syntax, Examples, Fixes
Claude Code subagent allowed-tools explained: the real field is tools, plus disallowedTools, MCP wildcards, inherit vs restrict, and hooks that enforce it.
· 10 min read
AI Agent Guardrails Example: Copy-Paste Claude Code Rules
An AI agent guardrails example for Claude Code: copy-paste permission rules, hooks and CLI caps that stop runaway loops, destructive commands and cost spikes.
· 10 min read
Claude Code Hooks Examples: 7 Copy-Paste Scripts
Claude Code hooks examples you can copy: 7 working scripts for guardrails, Stop-hook stall prevention, and usage logging, with settings.json and fixes.
· 10 min read
Claude Code: How to See Token Usage (and Reduce It)
Claude Code how to see token usage: run /usage in a session, read total_cost_usd from headless JSON runs, check the Console Usage page, and set cost alerts.
· 9 min read
Claude Code Hooks Lifecycle: Every Event, Explained
Claude Code hooks lifecycle explained: when each hook event fires in an automation run, and which ones stop runaway token use or silent failures.