Skip to main content

AI coding glossary

Hook (Claude Code Hook)

Also known as: claude code hooks, pretoolhook, posttoolhook

In one sentence

A shell command Claude Code executes automatically in response to events (PreToolUse, PostToolUse, Stop, UserPromptSubmit) configured in settings.json.

Full definition

Hooks are shell commands that Claude Code (and increasingly other AI agents) execute automatically in response to events. Common events include PreToolUse (before any tool call), PostToolUse (after a tool succeeds), Stop (when Claude finishes responding), and UserPromptSubmit (when the user sends a message). Configured in `.claude/settings.json`, hooks let you enforce policy (block dangerous commands), automate workflows (run tests after edits), or send notifications. Hooks are distinct from skills (instructions) and MCP servers (capabilities), hooks are pure shell automation triggered by agent events.

On skills-hub.ai

Related terms