Answer: Hooks are set up by event type, with patterns including SessionStart to dynamically load context, PreToolUse to log every bash command, PostToolUse to auto-format code after Write/Edit, PermissionRequest to route permission prompts for review, Stop to run deterministic checks or nudge Claude, and PostCompact to re-inject critical instructions after context compression. An example PostToolUse hook uses a matcher of "Write|Edit" with a command hook running "bun run format || true". Status: Confirmed Entry: tool/claude-apps/settings/hooks-setup Revision: 3 Digest: sha256:974dfb176adeae37 (changes whenever the content changes) Timeline: Created: 2026-11-13T02:59:37Z Last changed: 2026-11-20T12:06:52Z (Example hook command: — → bun run format || true) Last verified: 2026-11-20T12:06:52Z Next check: 2026-11-21T12:06:52Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of SessionStart pattern | SessionStart | [1] | 2026-11-20 PreToolUse pattern | PreToolUse | [1] | 2026-11-20 PostToolUse pattern | PostToolUse | [1] | 2026-11-20 PermissionRequest pattern | PermissionRequest | [1] | 2026-11-20 Stop pattern | Stop | [1] | 2026-11-20 PostCompact pattern | PostCompact | [1] | 2026-11-20 Example PostToolUse matcher | Write|Edit | [1] | 2026-11-20 Example hook command | bun run format || true | [1] | 2026-11-20 Sources: [1] Anthropic. "Claude Code power user tips | Claude Help Center". https://support.claude.com/en/articles/14554000-claude-code-power-user-tips Role: primary. Accessed: 2026-11-20T12:06:52Z Quote: "SessionStart Dynamically load context each time you start Claude" (Supports: SessionStart pattern) Quote: "PreToolUse Log every bash command the model runs" (Supports: PreToolUse pattern) Quote: "PostToolUse Auto-format code after Write/Edit to prevent CI failures" (Supports: PostToolUse pattern) Quote: "PermissionRequest Route permission prompts to Slack, WhatsApp, or Opus for review" (Supports: PermissionRequest pattern) Quote: "Stop Run deterministic checks on long tasks, or nudge Claude to keep going" (Supports: Stop pattern) Quote: "PostCompact Re-inject critical instructions after context compression" (Supports: PostCompact pattern) Quote: ""matcher": "Write|Edit"" (Supports: Example PostToolUse matcher) Quote: ""command": "bun run format || true"" (Supports: Example hook command) Snapshot SHA-256: 8e7682c57e62b0fd30806fdbc5c1727178bfdef26e7f52be70f60674ef054307 (captured 2026-11-20T12:06:50Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. Cross-check: not-available at 2026-11-20T12:06:52Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:06:52Z Last attempt: 2026-11-20T12:06:52Z Notes and limitations: Extracted automatically from a single official source (section "Common hook patterns"). Related: https://latestn.com/tool/claude-apps/settings/limit-reset-expiry-location Where can I see when my Claude limit reset expires? https://latestn.com/tool/claude-apps/settings/manage-automatic-model-switching How do I manage or disable automatic model switching in Claude? https://latestn.com/tool/claude-apps/settings/manage-connectors How do I manage or remove my connectors in Claude? https://latestn.com/tool/claude-apps/settings/feedback-setting-location Where is the feedback setting located in Claude Console? https://latestn.com/tool/claude-apps/settings/find-api-keys-page Where in the Claude Console can I find the API keys page to manage my keys? https://latestn.com/tool/claude-apps/settings/find-switch-to-annual-button Where do I find the Switch to Annual button in Claude? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-20T12:06:52Z | changed | Example hook command: — → bun run format || true | [1] 2026-11-20T12:06:52Z | changed | PostCompact pattern: — → PostCompact | [1] 2026-11-20T12:06:52Z | changed | Stop pattern: — → Stop | [1] 2026-11-20T12:06:52Z | changed | PermissionRequest pattern: — → PermissionRequest | [1] 2026-11-20T12:06:52Z | changed | PostToolUse pattern: — → PostToolUse | [1] 2026-11-20T12:06:52Z | changed | PreToolUse pattern: — → PreToolUse | [1] 2026-11-20T12:06:52Z | changed | SessionStart pattern: — → SessionStart | [1] 2026-11-20T12:06:52Z | changed | Example PostToolUse command: bun run format || true → — | [1] 2026-11-20T12:06:52Z | changed | PostCompact hook use case: Re-inject critical instructions after context compression → — | [1] 2026-11-20T12:06:52Z | changed | Stop hook use case: Run deterministic checks on long tasks, or nudge Claude to keep going → — | [1] 2026-11-20T12:06:52Z | changed | PermissionRequest hook use case: Route permission prompts to Slack, WhatsApp, or Opus for review → — | [1] 2026-11-20T12:06:52Z | changed | PostToolUse hook use case: Auto-format code after Write/Edit to prevent CI failures → — | [1] 2026-11-20T12:06:52Z | changed | PreToolUse hook use case: Log every bash command the model runs → — | [1] 2026-11-20T12:06:52Z | changed | SessionStart hook use case: Dynamically load context each time you start Claude → — | [1] 2026-11-17T12:09:11Z | changed | Example PostToolUse command: — → bun run format || true | [1] 2026-11-17T12:09:11Z | changed | Example PostToolUse matcher: — → Write|Edit | [1] 2026-11-17T12:09:11Z | changed | PostCompact hook use case: — → Re-inject critical instructions after context compression | [1] 2026-11-17T12:09:11Z | changed | Stop hook use case: — → Run deterministic checks on long tasks, or nudge Claude to keep going | [1] 2026-11-17T12:09:11Z | changed | PermissionRequest hook use case: — → Route permission prompts to Slack, WhatsApp, or Opus for review | [1] 2026-11-17T12:09:11Z | changed | PostToolUse hook use case: — → Auto-format code after Write/Edit to prevent CI failures | [1] 2026-11-17T12:09:11Z | changed | PreToolUse hook use case: — → Log every bash command the model runs | [1] 2026-11-17T12:09:11Z | changed | SessionStart hook use case: — → Dynamically load context each time you start Claude | [1] 2026-11-17T12:09:11Z | changed | PostToolUse example command: bun run format || true → — | [1] 2026-11-17T12:09:11Z | changed | PostToolUse example matcher: Write|Edit → — | [1] 2026-11-17T12:09:11Z | changed | PostCompact use case: Re-inject critical instructions after context compression → — | [1] 2026-11-17T12:09:11Z | changed | Stop use case: Run deterministic checks on long tasks, or nudge Claude to keep going → — | [1] 2026-11-17T12:09:11Z | changed | PermissionRequest use case: Route permission prompts to Slack, WhatsApp, or Opus for review → — | [1] 2026-11-17T12:09:11Z | changed | PostToolUse use case: Auto-format code after Write/Edit to prevent CI failures → — | [1] 2026-11-17T12:09:11Z | changed | PreToolUse use case: Log every bash command the model runs → — | [1] 2026-11-17T12:09:11Z | changed | SessionStart use case: Dynamically load context each time you start Claude → — | [1] 2026-11-13T02:59:37Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/claude-apps/settings/hooks-setup/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/claude-apps/settings/hooks-setup POST: https://latestn.com/dispute/tool/claude-apps/settings/hooks-setup with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/claude-apps/settings/hooks-setup?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I set up hooks in Claude Code and what hook patterns exist? Revision 3, last verified 2026-11-20T12:06:52Z. https://latestn.com/tool/claude-apps/settings/hooks-setup (accessed 2026-11-21T09:54:09Z). @misc{LatestN_tool_claude_apps_settings_hooks_setup_r3, title = {How do I set up hooks in Claude Code and what hook patterns exist?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/claude-apps/settings/hooks-setup}}, note = {Revision 3; digest sha256:974dfb176adeae37; last verified 2026-11-20T12:06:52Z; accessed 2026-11-21T09:54:09Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/claude-apps/settings/hooks-setup