Skills
Claude Code Hooks: Enforcing Policy at the Lifecycle Layer Without Trusting the Model
Claude Code Hooks execute user-defined shell commands or HTTP endpoints at specific session lifecycle points — PreToolUse (blocks/rewrites tool calls before execution) and PostToolUse (reacts to results). The PreToolUse hook's updatedInput return allows rewriting tool parameters before the model acts, enabling policy enforcement that does not rely on the model's judgment. Community repositories (disler/claude-code-hooks-mastery, rohitg00/awesome-claude-code-toolkit) provide production-ready hook patterns for blocking writes to sensitive paths, auto-running tests, and sending Slack notifications on task completion.
Source
↳ Follow the thread