Hook Development

Originally fromovachiever/droid-tings
Installation
Summary

Event-driven automation for Claude Code plugins using prompt-based and command hooks across the development lifecycle.

  • Supports 9 hook events (PreToolUse, PostToolUse, Stop, SubagentStop, UserPromptSubmit, SessionStart, SessionEnd, PreCompact, Notification) for validation, policy enforcement, and workflow automation
  • Prompt-based hooks recommended for context-aware decisions; command hooks for deterministic checks with bash scripting
  • Two configuration formats: plugin hooks/hooks.json (wrapped) and user .claude/settings.json (direct), with tool name matchers supporting exact, regex, and wildcard patterns
  • Hooks execute in parallel at session start; requires session restart to load configuration changes; includes security best practices for input validation, path safety, and variable quoting
  • Built-in environment variables (${CLAUDE_PLUGIN_ROOT}, $CLAUDE_PROJECT_DIR, $CLAUDE_ENV_FILE) enable portable, context-aware hook implementations with structured JSON input/output
SKILL.md

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:

Related skills

More from anthropics/claude-code

Installs
GitHub Stars
122.7K
First Seen