hook-development

Validate and implement event-driven plugin hooks for Claude Code.

Updated Apr 9, 2026
One-click install
npx skills add https://github.com/dobrinz123/claude-skills-share --skill hook-development-dobrinz123
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hook-development
Source: https://github.com/dobrinz123/claude-skills-share/tree/main/plugins/plugin-dev/skills/hook-development
Command: npx skills add https://github.com/dobrinz123/claude-skills-share --skill hook-development-dobrinz123

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Provides structured guidance and tooling to create, validate, and manage event-driven hooks for Claude Code plugins so developers can enforce safety, policy, and automation at runtime without ad-hoc scripting.

Core Features & Use Cases

  • Prompt-based and command hooks: Guidance for using LLM prompts for context-aware validation and bash/command hooks for deterministic checks.
  • Event coverage: Patterns and examples for PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, and Notification events.
  • Validation & testing tools: Includes schema validation, linting, test harnesses, example scripts, and best practices for timeouts, parallel execution, and environment persistence.
  • Use Case: Enforce safe file writes and privileged command confirmation in a plugin by combining quick command checks with deeper prompt-based analysis and a session-start context loader.

Quick Start

Add a PreToolUse prompt hook that validates file writes for path traversal, sensitive filenames, and returns an approve or deny decision.

Frequently Asked Questions about hook-development

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

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

To create event-driven hooks for Claude Code plugins, you define JSON decision outputs and scripts that approve, deny, modify, or augment tool usage. This Skill provides structured guidance for implementing prompt-based and command hooks across session lifecycle events.

What is a PreToolUse hook and how does it validate tool usage?

A PreToolUse hook validates tool usage by intercepting actions before execution to approve or deny them. You can apply command checks for deterministic validation or LLM prompts for context-aware analysis, returning JSON decisions to enforce safety policies.

Can I manage session lifecycle and state with Claude Code hooks?

Yes, you can manage session lifecycle and state using SessionStart, SessionEnd, and SubagentStop hooks. These event-driven patterns allow you to load context, persist environment variables via CLAUDE_ENV_FILE, and automate workflows during session transitions.

Does this approach support timeout and parallel execution handling for hooks?

Yes, this approach supports timeout and parallel execution handling for hooks. It includes schema validation, linting, and test harnesses alongside best practices to ensure your event-driven plugin hooks execute reliably without blocking workflows.

Do I need jq installed to validate and run Claude Code hooks?

Yes, you need jq installed as a dependency to validate and run these Claude Code hooks. The Skill utilizes jq for processing JSON decision outputs and executing schema validation within the provided test utilities and scripts.

What is the best way to enforce safe file writes in a Claude Code plugin?

The best way to enforce safe file writes is by combining a PreToolUse command hook for quick path traversal checks with a prompt hook for deeper context analysis. This returns an approve or deny JSON decision before the tool executes.