Hooks reference - Claude Code Docs

BlogJul 4, 2026

AI Summary

The official Claude Code reference for hooks — user-defined shell commands, HTTP endpoints, or LLM prompts that fire automatically at specific points in a session's lifecycle. Documents the full event list (SessionStart, PreToolUse, PostToolUse, Stop, SubagentStart/Stop, PreCompact, etc.), JSON input/output schemas, exit-code behavior, and async/HTTP/agent-based hook types.

Original excerpt

Hooks are user-defined shell commands, HTTP endpoints, or LLM prompts that execute automatically at specific points in Claude Code's lifecycle. This reference documents event schemas, configuration options, JSON input/output formats, and advanced features like async hooks, HTTP hooks, and MCP tool hooks.

Hook lifecycle: hooks fire at specific points during a session. When an event fires and a matcher matches, Claude Code passes JSON context about the event to the hook handler — for command hooks, input arrives on stdin; for HTTP hooks, as the POST request body. Events fall into three cadences: once per session (SessionStart, SessionEnd), once per turn (UserPromptSubmit, Stop, StopFailure),…

Frequently asked questions

What is "Hooks reference - Claude Code Docs" about?

The official Claude Code reference for hooks — user-defined shell commands, HTTP endpoints, or LLM prompts that fire automatically at specific points in a session's lifecycle. Documents the full event list (SessionStart, PreToolUse, PostToolUse, Stop, SubagentStart/Stop, PreCompact, etc.), JSON inpu…

Who wrote "Hooks reference - Claude Code Docs"?

This piece is part of the Claude Code vault on Burn 451, covering agentic coding with claude. The original author is attributed at the source link.

How can I read more content from Claude Code?

The complete Claude Code reading list is available at burn451.cloud/vault/claude-code. Each article includes an AI-generated summary so you can decide what to read in seconds. Connect the Burn 451 MCP server to Claude or Cursor to query all Claude Code articles as live AI context.

Can I use "Hooks reference - Claude Code Docs" with Claude or Cursor?

Yes. Install the burn-mcp-server npm package and connect it to Claude Desktop, Claude Code, or Cursor. Once connected, your AI can search and reference this article and the full Claude Code vault in real time — no manual copy-paste required.

12 more articles in this vault.

Import the full Claude Code vault to Burn 451 and build your own knowledge base.

Content attributed to the original author. Burn 451 curates publicly available writing as a reading index. For removal requests, contact @hawking520.