building-hooks

Create Claude Code event hooks for policy enforcement and tool orchestration.

3|2|Updated Nov 11, 2025
One-click install
npx skills add https://github.com/C0ntr0lledCha0s/claude-code-plugin-automations --skill building-hooks-c0ntr0lledcha0s
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: building-hooks
Source: https://github.com/C0ntr0lledCha0s/claude-code-plugin-automations/tree/main/agent-builder/skills/building-hooks
Command: npx skills add https://github.com/C0ntr0lledCha0s/claude-code-plugin-automations --skill building-hooks-c0ntr0lledcha0s

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

You can create and manage Claude Code event hooks to automate policy, logging, and pre/post-processing around tool invocations.

Core Features & Use Cases

  • Hook schemas & events (PreToolUse, PostToolUse, UserPromptSubmit, Stop, SessionStart)
  • Command hooks (bash-based) and prompt hooks (LLM-based)
  • Return values for control flow (continue, decision, reason, systemMessage)
  • Security considerations and validation guidance
  • Progressive discovery of resources (references, scripts, templates)

Quick Start

Use hooks to validate a PreToolUse event by running a script and returning a decision object.

Frequently Asked Questions about building-hooks

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

FAQPage Schema
How do I automate policy enforcement with Claude Code hooks?

Policy enforcement with hooks involves creating event-driven rules that validate tool invocations before they execute. Use PreToolUse hooks to run validation scripts, return a decision object (allow/block), and enforce standardized behaviors across projects without manual intervention.

What hook events does Claude Code support for automation?

Claude Code supports PreToolUse, PostToolUse, UserPromptSubmit, Stop, and SessionStart events. Each event fires at specific points in the workflow, letting you intercept and control tool invocations, prompts, and session lifecycle for logging, validation, and orchestration.

Can I use command hooks and prompt hooks together?

Yes. Command hooks run bash scripts for fast validation and system integration, while prompt hooks invoke the LLM for semantic decision-making. Both return control-flow values (continue, decision, reason, systemMessage) and can be combined within the same hook configuration.

How do I validate hook configurations across multiple directories?

Hooks enforce a JSON schema that validates matchers and hook structures. Deploy hooks at project-level or directory-level scopes to apply standardized configurations automatically. The schema validation catches misconfigurations before runtime.

What security considerations apply when writing hooks?

Hooks have access to tool invocations and prompts, so validate input rigorously, avoid exposing sensitive data in logs, and use matchers to scope hooks narrowly. The metadata includes security guidance for safe hook design and preventing policy bypass.

Do I need prior scripting experience to build hooks?

Basic bash and JSON knowledge helps but aren't strictly required. The Skill provides templates and reference patterns for command and prompt hooks. Quick-start examples show how to validate a PreToolUse event with a simple script and decision object.