Hook Development

Create and implement Claude Code plugin hooks for event-driven automation.

11|Updated Dec 2, 2025
One-click install
npx skills add https://github.com/troykelly/claude-skills --skill hook-development-troykelly
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Hook Development
Source: https://github.com/troykelly/claude-skills/tree/main/external/skills/hook-development
Command: npx skills add https://github.com/troykelly/claude-skills --skill hook-development-troykelly

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill provides guidance for creating and implementing Claude Code plugin hooks, including PreToolUse and PostToolUse hooks, Stop/SubagentStop hooks, and session-loading hooks. It focuses on event-driven automation to validate tool usage, enforce policies, and orchestrate workflows.

Core Features & Use Cases

  • Prompt-based hooks for nuanced decisions (PreToolUse, PostToolUse, SessionStart)
  • Command-based hooks for deterministic checks
  • Hook configuration patterns for plugins (hooks.json)
  • Best practices for edge cases, timeouts, and performance
  • Guidance on when to use prompt vs command hooks

Quick Start

Define a PreToolUse hook for a specific tool in hooks/hooks.json, then implement a corresponding command or prompt hook script as needed. Use the hook patterns to validate, gate, or transform tool input and outcomes.