Claude Code Hooks System

Configure lifecycle event hooks with shell commands, HTTP requests, or LLM prompts.

18|2|Updated Dec 12, 2025
One-click install
npx skills add https://github.com/markus41/claude --skill claude-code-hooks-system
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Claude Code Hooks System
Source: https://github.com/markus41/claude/tree/main/plugins/claude-code-expert/skills/hooks-system
Command: npx skills add https://github.com/markus41/claude --skill claude-code-hooks-system

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill allows users to intercept and modify Claude's behavior at various lifecycle events by executing custom scripts or commands, providing fine-grained control and automation.

Core Features & Use Cases

  • Lifecycle Event Hooks: Execute custom logic before or after tool use, session start/end, notifications, and more.
  • Customizable Actions: Block or modify tool calls, trigger external scripts, send notifications, or force Claude to continue execution.
  • Use Case: Automatically block any rm -rf commands executed by Claude's Bash tool to prevent accidental data loss, or trigger a desktop notification whenever Claude sends a message to the user.

Quick Start

Configure a PreToolUse hook to approve all tool calls by default.

Frequently Asked Questions about Claude Code Hooks System

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate custom scripts during the Claude Code lifecycle?

You can automate custom scripts during the Claude Code lifecycle by defining shell commands, HTTP requests, or LLM prompts in settings.json. These hooks execute at specific events like UserPromptSubmit or PreToolUse to control agent behavior.

Can I block specific tool calls like rm -rf before Claude executes them?

Yes, you can block specific tool calls like rm -rf by configuring a PreToolUse hook. The hook intercepts the tool execution, validates the structured JSON input, and blocks dangerous commands before the Bash tool runs them.

How do I trigger desktop notifications when Claude sends a message?

To trigger desktop notifications when Claude sends a message, configure a Notification hook. This lifecycle event executes your custom shell command or script automatically whenever Claude outputs a message to the user.

Does the Claude Code hooks system support synchronous execution and structured JSON input?

Yes, the Claude Code hooks system supports synchronous execution and structured JSON input/output. This allows you to manage control flow, validate tool calls, and automate responses reliably at specific lifecycle events.

What lifecycle event types are available for hook customization?

Available lifecycle event types for hook customization include UserPromptSubmit, PreToolUse, and Notification. These events allow you to intercept and modify Claude's behavior at various points by executing custom logic via shell commands or HTTP requests.

How do I configure settings to approve all tool calls by default?

To approve all tool calls by default, configure a PreToolUse hook in your settings.json file. This setup automatically validates and approves tool execution requests, streamlining the agent's workflow without manual intervention.