hook-development

Build and validate Claude Code plugin hooks for event-driven automation.

4|1|Updated Nov 1, 2025
One-click install
npx skills add https://github.com/xtrm-dev/specialists --skill hook-development-xtrm-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hook-development
Source: https://github.com/xtrm-dev/specialists/tree/main/.xtrm/skills/default/hook-development
Command: npx skills add https://github.com/xtrm-dev/specialists --skill hook-development-xtrm-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill removes the guesswork from building Claude Code plugin hooks by showing how to validate tool use, enforce safety policies, load session context, and automate responses to agent events.

Core Features & Use Cases

  • Event-driven automation: Create hooks for PreToolUse, PostToolUse, Stop, SessionStart, SessionEnd, and Notification workflows.
  • Security and policy enforcement: Block dangerous commands, guard sensitive file writes, and add approval steps for risky operations.
  • Testing and maintainability: Validate hook schemas, lint hook scripts, and run sample inputs before deployment.
  • Use case: A plugin can load project context at session start, deny destructive Bash commands, and require completion checks before the session stops.

Quick Start

Ask the assistant to design a Claude Code hook that validates Bash or file-write actions using the safety patterns 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 create Claude Code hooks to block risky Bash commands?

Claude Code hooks block risky Bash commands by defining PreToolUse event workflows that parse stdin with jq, validate command schemas, and return safe exit codes to deny execution. This Skill generates and validates those hook definitions automatically.

Can I enforce quality gates and load context on session start in Claude Code?

SessionStart hooks can load project context automatically when a Claude Code session begins. You define JSON hook schemas using portable ${CLAUDE_PLUGIN_ROOT} paths to inject environment data and enforce quality gates before the agent starts processing.

What is the best way to validate Claude Code plugin hook schemas before deployment?

Validating Claude Code plugin hook schemas requires linting hook scripts and running sample inputs to test behavior. This Skill automates schema validation, checks JSON structures, and verifies safe exit-code handling for reliable deployment.

Do I need jq and timeout installed to build event-driven automation hooks?

Yes, jq and timeout are required dependencies for building event-driven automation hooks. jq parses stdin JSON payloads during PreToolUse or PostToolUse events, while timeout enforces execution limits to prevent hanging scripts.

Why does my PostToolUse hook fail to parse stdin JSON correctly?

PostToolUse hooks fail to parse stdin JSON when schemas are malformed or jq parsing logic is incorrect. This Skill ensures proper JSON hook schemas, validates jq stdin extraction, and enforces safe exit-code handling to prevent silent failures.