Hook Development

Create and validate Claude Code plugin hooks for tool-use events.

6|Updated Dec 30, 2025
One-click install
npx skills add https://github.com/pur3v4d3r/pur3-pkb-codebase --skill hook-development-pur3v4d3r
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Hook Development
Source: https://github.com/pur3v4d3r/pur3-pkb-codebase/tree/main/.claude/skills/hook-development
Command: npx skills add https://github.com/pur3v4d3r/pur3-pkb-codebase --skill hook-development-pur3v4d3r

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Hook Development provides a structured framework for creating and validating Claude Code plugin hooks, enabling safe, automated tool usage and event-driven workflows.

Core Features & Use Cases

  • Supports PreToolUse, PostToolUse, Stop, SessionStart and other hook events
  • Promotes advanced prompt-based hooks API for flexible, context-aware validation
  • Includes templates, patterns, and best practices for secure automation

Quick Start

Describe a new PreToolUse hook that validates a tool call and responds with a permission 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 a Claude Code hook to validate tool calls?

To create a Claude Code hook for tool validation, implement a PreToolUse hook using prompt-based or command-based APIs to intercept and validate tool calls, returning a permission decision to enforce safe automation.

What events are available for Claude Code plugin hooks?

Claude Code plugin hooks support events including PreToolUse, PostToolUse, Stop, and SessionStart, enabling developers to automate workflows and enforce safety checks at various stages of the execution lifecycle.

How do I use environment variables and paths safely in Claude Code hooks?

Use the CLAUDE_PLUGIN_ROOT environment variable for portable path references in Claude Code hooks to ensure secure integration, validating tool usage and loading memory without exposing sensitive environment data.

Can I build both prompt-based and command-based hooks for Claude Code automation?

Yes, Claude Code supports both prompt-based and command-based hooks, allowing developers to choose between context-aware validation prompts or direct command execution for automating workflows and enforcing security policies.

What are the best practices for testing Claude Code hooks?

Best practices for testing Claude Code hooks include validating tool-use decisions, verifying memory loading behavior, and ensuring secure integration with CLAUDE_PLUGIN_ROOT paths across all supported plugin events.

Why is my Claude Code hook not triggering on SessionStart or Stop events?

Claude Code hooks may fail to trigger if event names are misconfigured or if portable path references using CLAUDE_PLUGIN_ROOT are invalid, so verify event names like SessionStart and Stop and test your hook configuration.