anthropics avatar

Hook Development

Adds event-driven automation to Claude Code through hooks that respond to tool use, session events, and user prompts. The prompt-based hooks are the standout feature here: instead of writing bash scripts to validate operations, you give Claude natural language criteria and let it reason about whether a file write is safe or a task is actually complete. You can still use command hooks for deterministic checks, but the LLM-driven approach handles edge cases better and requires less maintenance. Most useful for enforcing policies (blocking dangerous commands, validating completeness before stopping) and loading project context automatically. Hook configuration goes in your plugin's hooks.json, and you get proper input/output formats with permission decisions and system messages.

skills.sh installs
7.5K
GitHub stars
46.7K
last updated
Aug 21, 2026

Install

$ npx -y skills add anthropics/claude-plugins-official --skill hook-development --agent claude-code

Installs into .claude/skills of the current project.

Files

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:

{
  "type": "prompt",
  "prompt": "Evaluate if this tool use is appropriate: $TOOL_INPUT",
  "timeout": 30
}

Supported events: Stop, SubagentStop, UserPromptSubmit, PreToolUse

Benefits:

  • Context-aware decisions based on natural language reasoning
  • Flexible evaluation logic without bash scripting
  • Better edge case handling
  • Easier to maintain and extend

Command Hooks

Execute bash commands for deterministic checks:

{
  "type": "command",
  "command": "bash ${CLAUDE_PLUGIN_ROOT}/scripts/validate.sh",
  "timeout": 60
}

Sponsors

Details

Repository
github.com/anthropics/claude-plugins-official
Categories
Frontend Development, Backend & APIs, AI & Agent Building, Automation & Workflows
First seen
May 16, 2026

More from anthropics/claude-plugins-official

All 24
1agricidaniel avatarseo-imagesagricidaniel/claude-seoImage optimization analysis for SEO and performance. Checks alt text, file sizes, formats, responsive images, lazy loading, CLS prevention, image SERP rankings 7.5Kskills.sh installs
2pproenca avatarzodpproenca/dot-skillsZod schema validation best practices for type safety, parsing, and error handling. This skill should be used when defining z.object schemas, using z.string vali7.2Kskills.sh installs
3wondelai avatarmicrointeractionswondelai/skillsDesign the small details -- triggers, rules, feedback, loops and modes -- that separate good products from great ones. Use when the user mentions "microinteract7.2Kskills.sh installs
4deckardger avatartanstack-router-best-practicesdeckardger/tanstack-agent-skillsTanStack Router best practices for type-safe routing, data loading, search params, and navigation. Activate when building React applications with complex routin7.2Kskills.sh installs
5vercel avatarvercel-clivercel/vercelDeploy, manage, inspect, and troubleshoot Vercel projects from the command line. Use for Vercel deployments, build failures, projects and teams, environment var7.2Kskills.sh installs
6affaan-m avatarbackend-patternsaffaan-m/eccBackend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes.7.2Kskills.sh installs