General

Hook Development for Claude Code Plugins

by anthropics/claude-code

This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks",…

Skill content

Hook Development for Claude Code Plugins

Overview

Hooks are event-driven automation scripts that execute in response to Claude Code events. Use hooks to validate operations, enforce policies, add context, and integrate external tools into workflows.

Key capabilities:

- Validate tool calls before execution (PreToolUse)

- React to tool results (PostToolUse)

- Enforce completion standards (Stop, SubagentStop)

- Load project context (SessionStart)

- Automate workflows across the development lifecycle

Hook Types

Prompt-Based Hooks (Recommended)

Use LLM-driven decision making for context-aware validation: