Hook Development

Build and validate Claude Code hook configurations for event-driven automation.

Updated Feb 15, 2026
One-click install
npx skills add https://github.com/ricable/mcai --skill hook-development-ricable
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Hook Development
Source: https://github.com/ricable/mcai/tree/main/.agents/skills/hook-development
Command: npx skills add https://github.com/ricable/mcai --skill hook-development-ricable

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires jq, timeout, and includes scripts (resource) and references (resource) components.

What problem does it solve?

Hook Development helps you design reliable Claude Code plugin hooks without guessing event formats, validation rules, or safety patterns. It reduces brittle automation by giving you structured guidance for approvals, denials, context loading, and completion checks.

Core Features & Use Cases

  • Prompt-based hooks for context-aware decisions on PreToolUse, Stop, SubagentStop, and UserPromptSubmit events.
  • Command hooks for deterministic checks, schema validation, environment setup, and portable script execution with CLAUDE_PLUGIN_ROOT.
  • Use cases include blocking destructive commands, validating file writes, loading session context, logging notifications, and enforcing tests before stopping.

Quick Start

Ask for a Claude Code hook configuration that validates a dangerous command, using the guidance in this skill.

Frequently Asked Questions about Hook Development

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

FAQPage Schema
How do I build Claude Code hooks to block dangerous commands automatically?

Claude Code hooks can validate file writes by configuring PostToolUse event hooks that use jq-based parsing to inspect file contents and enforce schema validation before allowing the operation to complete.

What is the difference between prompt hooks and command hooks in Claude Code?

Claude Code prompt hooks handle context-aware decisions for events like Stop and SubagentStop, while command hooks execute deterministic checks, environment setup, and portable script execution using CLAUDE_PLUGIN_ROOT paths.

Do I need jq installed to run Claude Code hook configurations?

Yes, you need jq installed to run Claude Code hook configurations because the hook execution logic relies on jq-based parsing to extract and validate data from JSON event payloads.

How do I load session context automatically when starting a Claude Code session?

You load session context automatically by configuring SessionStart event hooks that execute scripts to load environment variables and context files using portable CLAUDE_PLUGIN_ROOT paths for deterministic setup.

What are the limitations of using exit-code control flow for Claude Code hooks?

Using exit-code control flow for Claude Code hooks limits you to deterministic binary approvals or denials, meaning complex context-aware decisions must be handled through prompt hooks rather than simple command scripts.