NachschlagenQuellenregister

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.2026
  • agent hooks spawn a subagent that can read files, search code, and use other tools to verify conditions before returning a decisionbestätigt 10.11.2026
  • with a longer default timeout of 60 seconds and up to 50 tool-use turnsbestätigt 10.11.2026
  • Use agent hooks when you need to verify something against the actual state of the codebase.bestätigt 10.11.2026
  • For production workflows, prefer command hooksbestätigt 10.11.2026
  • Behavior and configuration may change in future releases.bestätigt 10.11.2026
  • Claude Code runs them at specific points in its lifecyclebestätigt 10.11.2026
  • To create a hook, add a hooks block to a settings filebestätigt 10.11.2026
  • When the hook succeeds, Claude Code shows nothing in the conversation.bestätigt 10.11.2026
  • You can also ask Claude to write the hook for you by describing what you want in the CLI.bestätigt 10.11.2026
  • Agent hooks are experimental and may change.bestätigt 10.11.2026
  • Matchers are case-sensitivebestätigt 10.11.2026
  • Adding it to any other event prevents the hook from running.bestätigt 10.11.2026
  • Claude can also create or modify files by running shell commands.bestätigt 10.11.2026
  • One hook returning deny doesn’t stop sibling hooks from executing.bestätigt 10.11.2026
  • so a project’s settings file can override yours.bestätigt 10.11.2026
  • Avoid having more than one hook rewrite the same tool’s input.bestätigt 10.11.2026
  • Claude Code doesn’t merge the rewrites or guarantee which rewrite the tool runs withbestätigt 10.11.2026
  • if you place it at the top level of the JSON, Claude Code silently ignores it.bestätigt 10.11.2026
  • Claude Code answers the request on your behalf.bestätigt 10.11.2026
  • Keep the matcher as narrow as possible.bestätigt 10.11.2026
  • This lets you enforce policy that users can’t bypass by changing their permission mode.bestätigt 10.11.2026
  • you can’t loosen restrictions past what permission rules allowbestätigt 10.11.2026
  • The model’s only job is to return its decision as JSONbestätigt 10.11.2026
  • up to 50 tool-use turnsbestätigt 10.11.2026
  • SessionEnd hooks of any type share a 1.5-second budget.bestätigt 10.11.2026
  • anything the profile prints reaches stdout ahead of your hook’s JSONbestätigt 10.11.2026
  • Stop hooks fire whenever Claude finishes responding, not only at task completion.bestätigt 10.11.2026
  • hooks can’t undo actions since the tool has already executed.bestätigt 10.11.2026
  • Command hooks communicate through stdout, stderr, and exit codes only.bestätigt 10.11.2026
  • If your machine has no managed settings and your session doesn’t use /login credentials for a Team or Enterprise plan, a mod can approve a call your PreToolUse hook blocked.steht dort nicht mehr
  • you get the same prompt, block, or approval the edit would get with no hook.bestätigt 10.11.2026
  • To 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

Alle Quellen

↑↓ auswählenEnter öffnenDie Suche läuft im Browser. Nichts wird übertragen.