create-hooks

Create and configure Claude Code hooks for event-driven automation and workflow control.

Updated Jun 22, 2026
One-click install
npx skills add https://github.com/Elad73/agentic-base-layer --skill create-hooks-elad73
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-hooks
Source: https://github.com/Elad73/agentic-base-layer/tree/main/global/skills/create-hooks
Command: npx skills add https://github.com/Elad73/agentic-base-layer --skill create-hooks-elad73

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill helps you create, configure, and debug Claude Code hooks so you can automate validation, logging, notifications, context injection, and stop conditions without changing core behavior.

Core Features & Use Cases

  • Hook Design Guidance: Choose the right event, matcher, and hook type for the job, whether you need to block unsafe commands or react after a tool finishes.
  • Command vs Prompt Decisions: Decide when to use fast shell-based hooks for deterministic tasks and when to use prompt-based hooks for semantic checks and reasoning.
  • Safety and Reliability: Apply timeout settings, JSON validation, permission checks, and stop-hook loop prevention to keep hook workflows stable.
  • Use Case: Set up a PreToolUse hook to block destructive git commands, a PostToolUse hook to format code after edits, or a SessionStart hook to inject project context automatically.

Quick Start

Ask for a Claude Code hook configuration for your specific event, matcher, and goal, and include whether you want a command hook or a prompt hook.

Frequently Asked Questions about create-hooks

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

FAQPage Schema
How do I create Claude Code hooks for event-driven automation?

Claude Code hooks are created by configuring JSON structures for specific events like PreToolUse, PostToolUse, or SessionStart to automate validation, logging, and context injection. You must define event-specific inputs, outputs, matcher patterns, and timeouts to ensure stable workflow control.

When should I use command hooks vs prompt hooks for validation?

Use command hooks for fast, deterministic shell-based tasks like blocking unsafe git commands, and choose prompt hooks when you need semantic checks and reasoning. Deciding between command and prompt hooks depends on whether your validation task requires simple pattern matching or complex logic evaluation.

Can I set up a PreToolUse hook to block destructive commands?

Yes, PreToolUse hooks can block destructive commands by applying matcher patterns to targeted tools and returning the correct JSON output schema to deny execution. This allows you to enforce safety checks and prevent unsafe operations before a tool runs.

How do I prevent stop-hook loops in Claude Code session management?

Prevent stop-hook loops by applying stop-hook loop safeguards within your hook configuration and setting appropriate timeouts. Managing hook reliability requires JSON validation and permission checks to keep your SessionStart, SessionEnd, and Stop event workflows stable.

Does Claude Code support PostToolUse hooks for automatic code formatting?

Yes, PostToolUse hooks support automatic code formatting by triggering actions immediately after a tool finishes editing. Configuring event-driven hooks for PostToolUse allows you to react to file modifications and apply formatting without altering core behavior.

What are the limitations of using matchers in Claude Code hooks?

Matchers are limited by their dependency on correct JSON hook configuration and event-specific input schemas. If matcher patterns are misconfigured or timeout settings are too restrictive, hook workflows may fail to trigger properly or cause unintended interruptions during tool execution.