Sign in
Explore
Skills · SkillEveryday codingReviewed

hook-development

Explains writing hooks for PreToolUse, PostToolUse, Stop and other events, including prompt-based hooks.

Kind
Skill
Works with
Claude Code
Source
anthropics/claude-plugins-official @ 58267944f921
Path
plugins/plugin-dev/skills/hook-development/SKILL.md
Jobs
Guardrails, Automation

Credit

Made by
anthropics
Original
github.com/anthropics/claude-plugins-official/blob/58267944f9…
License
Apache-2.0

Listed by Skill Manifest; not made by us.

InstallInstall it from a plugin marketplace.
/plugin install plugin-dev@claude-plugins-official
Install factsScanned 2 Nov 2026
Adds
  • .claude/skills/hook-development/ (the skill folder)
  • 7 file(s) the skill refers to
Runs scripts
Yes
  • your-hook.sh
  • shell block in the text
Uses the network
None found
Needs secrets
None found
Reads environment variables
  • TOOL_INPUT
  • TOOL_RESULT
  • USER_PROMPT
  • FLAG_FILE
  • CONFIG_FILE
  • PROJECT_TYPE
Source revision
58267944f921
Licence
Apache-2.0
Last activity
1 Nov 2026
Review
Reviewed

Found by a static scan of the stored text; nothing is run. “None found” is not a guarantee, so read what you install before you run it.

  • Only the main file is read; other files in the folder are not scanned
# 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:

```json
{
  "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:

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