hook-development

Create and validate event-driven hooks for Claude Code plugins.

16|1|Updated Mar 20, 2026
One-click install
npx skills add https://github.com/SocialGouv/iterion --skill hook-development-socialgouv
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: hook-development
Source: https://github.com/SocialGouv/iterion/tree/main/vendor/github.com/SocialGouv/claw-code-go/internal/tools/bundled_skills/plugin-dev/skills/hook-development
Command: npx skills add https://github.com/SocialGouv/iterion --skill hook-development-socialgouv

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Building hooks for Claude Code plugins requires knowing the correct hooks.json schema, event types, input/output JSON formats, and security practices, and mistakes silently break automation or create injection risks. ## Core Features & Use Cases - Hook Implementation Guidance: Covers all hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification) with both prompt-based and command hook configurations. - Validation and Testing Scripts: Includes validate-hook-schema.sh for hooks.json structure checks, test-hook.sh for running hooks against sample input, and hook-linter.sh for catching quoting, path, and error-handling issues. - Use Case: When adding a PreToolUse hook that blocks dangerous bash commands in a plugin, use this Skill to write the hooks.json entry, lint the validation script, and test it with sample JSON before restarting Claude Code. ## Quick Start Create a PreToolUse prompt-based hook in my plugin's hooks.json that validates file writes for path traversal and sensitive files.

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 PreToolUse hook in Claude Code?▼

Add a PreToolUse entry in your plugin's hooks/hooks.json with a matcher for tool names and a hooks array containing a command or prompt hook. Prompt hooks use natural language validation, while command hooks execute bash scripts that return JSON decisions.

What is the difference between prompt hooks and command hooks?▼

Prompt hooks use LLM reasoning for context-aware validation and are supported on Stop, SubagentStop, UserPromptSubmit, and PreToolUse events. Command hooks run bash scripts for fast deterministic checks, file operations, and external tool integration.

Why are my hook changes not taking effect in Claude Code?▼

Hooks load only at session start, so editing hooks.json or hook scripts does not affect the current session. Exit Claude Code and restart it, then verify loaded hooks with the /hooks command or claude --debug.

How do I test a hook script before deploying it?▼

Use the test-hook.sh script with a sample JSON input file, which you can generate with the --create-sample flag for a given event type. It sets environment variables, measures execution time, and validates the output JSON and exit code.

What exit codes should a Claude Code hook script return?▼

Hook scripts should exit 0 for success, where stdout appears in the transcript, or exit 2 for a blocking error, where stderr is fed back to Claude. Other exit codes are treated as non-blocking errors.