Dokumentationerreichbar
Automate actions with hooks (Claude Code Docs, Anthropic)
code.claude.com (externe Seite)
Anleitung zu Hooks: Shell-Befehle, die Claude Code an festen Stellen der Sitzung selbst ausführt, etwa nach einer Dateiänderung, am Ende einer Antwort oder vor einer Rückfrage, mit Beispielen zum Formatieren, Benachrichtigen und Sperren.
geprüft 10.11.2026
Worauf sich diese Seite beruft, wörtlich, abgerufen am 12.10.2026:
Agent hooks are experimental.
bestätigt 10.11.2026agent hooks spawn a subagent that can read files, search code, and use other tools to verify conditions before returning a decision
bestätigt 10.11.2026with a longer default timeout of 60 seconds and up to 50 tool-use turns
bestätigt 10.11.2026Use agent hooks when you need to verify something against the actual state of the codebase.
bestätigt 10.11.2026For production workflows, prefer command hooks
bestätigt 10.11.2026Behavior and configuration may change in future releases.
bestätigt 10.11.2026Claude Code runs them at specific points in its lifecycle
bestätigt 10.11.2026To create a hook, add a hooks block to a settings file
bestätigt 10.11.2026When the hook succeeds, Claude Code shows nothing in the conversation.
bestätigt 10.11.2026You can also ask Claude to write the hook for you by describing what you want in the CLI.
bestätigt 10.11.2026Agent hooks are experimental and may change.
bestätigt 10.11.2026Matchers are case-sensitive
bestätigt 10.11.2026Adding it to any other event prevents the hook from running.
bestätigt 10.11.2026Claude can also create or modify files by running shell commands.
bestätigt 10.11.2026One hook returning deny doesn’t stop sibling hooks from executing.
bestätigt 10.11.2026so a project’s settings file can override yours.
bestätigt 10.11.2026Avoid having more than one hook rewrite the same tool’s input.
bestätigt 10.11.2026Claude Code doesn’t merge the rewrites or guarantee which rewrite the tool runs with
bestätigt 10.11.2026if you place it at the top level of the JSON, Claude Code silently ignores it.
bestätigt 10.11.2026Claude Code answers the request on your behalf.
bestätigt 10.11.2026Keep the matcher as narrow as possible.
bestätigt 10.11.2026This lets you enforce policy that users can’t bypass by changing their permission mode.
bestätigt 10.11.2026you can’t loosen restrictions past what permission rules allow
bestätigt 10.11.2026The model’s only job is to return its decision as JSON
bestätigt 10.11.2026up to 50 tool-use turns
bestätigt 10.11.2026Session
bestätigt 10.11.2026End hooks of any type share a 1.5-second budget. anything the profile prints reaches stdout ahead of your hook’s JSON
bestätigt 10.11.2026Stop hooks fire whenever Claude finishes responding, not only at task completion.
bestätigt 10.11.2026hooks can’t undo actions since the tool has already executed.
bestätigt 10.11.2026Command hooks communicate through stdout, stderr, and exit codes only.
bestätigt 10.11.2026If your machine has no managed settings and your session doesn’t use /
steht dort nicht mehrlogin credentials for a Team or Enterprise plan, a mod can approve a call your Pre Tool Use hook blocked. you get the same prompt, block, or approval the edit would get with no hook.
bestätigt 10.11.2026To lift this limit on hook approvals, approve the plan or switch to another permission mode.
bestätigt 10.11.2026
18 Hooks und Mods24 Test und Spezifikation zuerst31 Der Harness