hook-development

Validate and automate Claude Code plugin hooks with JSON configurations.

1.0k|91|Updated Jul 9, 2025
One-click install
npx skills add https://github.com/fcakyon/claude-codex-settings --skill hook-development-fcakyon
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hook-development
Source: https://github.com/fcakyon/claude-codex-settings/tree/main/plugins/plugin-dev/skills/hook-development
Command: npx skills add https://github.com/fcakyon/claude-codex-settings --skill hook-development-fcakyon

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API, ensuring robust, secure, and reusable event-driven automation.

Core Features & Use Cases

  • Hook types: Prompt-based hooks for complex decisions and command hooks for deterministic checks.
  • Hook configurations: Examples for plugin hooks.json and settings.json formats.
  • Common events: PreToolUse, PostToolUse, Stop, SessionStart, etc., with guidance on when to use each.

Quick Start

Create a new hook following the patterns in the examples and validate with the provided scripts.

Frequently Asked Questions about hook-development

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create event-driven hooks for Claude Code plugins?

Event-driven hooks automate actions triggered by Claude Code events like PreToolUse, PostToolUse, and SessionStart. Define hooks in hooks.json or settings.json with event type, matcher, command or prompt, and timeout. Use prompt-based hooks for complex decisions and command hooks for deterministic checks, then validate with validate-hook-schema.sh.

What hook events does Claude Code support?

Claude Code supports PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, and UserPromptSubmit events. Each event enables different automation points: PreToolUse for input validation, PostToolUse for output processing, SessionStart for context loading, and others for state management and cross-tool orchestration.

How do I validate and test plugin hooks?

Validate hook configurations using validate-hook-schema.sh to check JSON structure, test-hook.sh to run hooks against sample inputs, and hook-linter.sh to lint for compliance. These tools catch schema errors, timeout issues, and policy violations before deployment.

Can I use environment variables to persist hook state across Claude Code sessions?

Yes, hooks support environment persistence via CLAUDE_ENV_FILE. Store session state, context, and configuration data in the environment file, then reference it across PreToolUse, PostToolUse, and other events for stateful automation and cross-tool orchestration.

What output schemas do prompt-based hooks support?

Prompt-based hooks output hookSpecificOutput for custom data, permissionDecision for access control, updatedInput to modify tool inputs, and systemMessage to inject instructions. JSON output schemas validate hook responses and ensure policy compliance across all hook types.

Do hook configurations support both wrapper and direct formats?

Yes, hook configurations support both wrapper format (hooks array nested under event) and direct format (flat event-to-hook mapping). Both formats use the same JSON schema with event, matcher, type, timeout, and command or prompt fields for flexibility across plugin architectures.