Back to Skills

create-hooks

Expert guidance for creating, configuring, and using Claude Code hooks. Use when working with hooks, setting up event listeners, validating commands, automating workflows, adding notifications, or understanding hook types (PreToolUse, PostToolUse, Stop, SessionStart, UserPromptSubmit, etc).

1,297stars349forksUpdated 2/9/2026

Security Assessment

Low Risk(70/100)

Detected risks:

Destructive Operations([SKILL.md] rm -rf)
Security Score70/100

About create-hooks

The 'create-hooks' skill is designed to help users create, configure, and manage event-driven automation within Claude Code by utilizing hooks. These hooks trigger specific actions, such as shell commands or LLM prompts, in response to predefined events like tool usage, session events, or user interactions. The skill solves the problem of integrating programmatic control over Claude's behavior without altering the core codebase, providing flexibility for automating workflows, implementing safety checks, and injecting context into user interactions.

The skill allows users to define hooks that can be triggered by various events such as 'PreToolUse' or 'PostToolUse', and can be configured to execute shell commands or evaluate prompts. These hooks can be customized based on specific tools or tool patterns, giving users the ability to block actions, modify inputs, log events, or perform external operations. It also supports flexible matcher configurations to determine which tools activate the hooks. This makes it highly adaptable for various project-specific needs, enhancing workflow automation and ensuring the integrity of commands and actions within Claude Code.

Use cases for this skill include logging specific tool interactions, validating user inputs, automating post-action tasks, and implementing custom completion criteria. It's ideal for developers and administrators working with Claude Code who need to implement custom event handling and automate routine tasks efficiently.

FAQ

How do I create a hook?

To create a hook, you need to define a configuration file, either in your project directory (.claude/hooks.json) or user directory (~/.claude/hooks.json). In this file, you will specify the event that triggers the hook, the type of hook (command or prompt), and any matchers that define which tools trigger the hook.

Can hooks block tool execution?

Yes, hooks triggered by events like 'PreToolUse', 'UserPromptSubmit', and 'Stop' can block tool execution. To block an action, you can return a JSON response with the decision 'block'.

What types of hooks are available?

There are two types of hooks: 'command' hooks, which execute shell commands, and 'prompt' hooks, which evaluate prompts using an LLM. Each type serves different use cases such as validation, logging, or complex decision-making.

Can I use custom tools with hooks?

Yes, you can configure hooks to fire based on custom tools by specifying matchers that define the tools or tool patterns that will trigger the hook. This allows you to target specific tools or tool categories.

Is there a limit to how many hooks I can define?

No specific limit is mentioned in the documentation. However, you should ensure that the hooks are efficiently configured to avoid performance issues as more hooks are added.

Install create-hooks

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill