Hook Development

•
46k
•

Create event-driven automation scripts (hooks) to validate operations, enforce policies, and customize Claude Code workflows.

Develop powerful, event-driven automation scripts (hooks) to customize and secure your Claude Code workflows. This skill provides comprehensive guidance for creating hooks that respond to lifecycle events like tool usage, session start, or task completion. Learn to implement both command-based hooks for deterministic checks and advanced, LLM-driven prompt-based hooks for context-aware validation and decision-making. Use hooks to enforce coding standards, block dangerous commands, load project-specific context, and integrate external tools, adding a robust layer of automation and policy enforcement to your development process.

主要功能

01Validate tool calls, block dangerous commands, and enforce project policies using PreToolUse hooks
0246,246 GitHub stars
03Automate context loading and environment setup with SessionStart hooks
04Define completion standards and verify task success using Stop and SubagentStop hooks
05Implement prompt-based and command-based hooks for event-driven automation
06Utilize portable environment variables like `${CLAUDE_PLUGIN_ROOT}` for creating shareable plugins

使用场景

01Enforcing project-specific coding standards before a file is written.
02Blocking potentially destructive commands, like `rm -rf /`, before execution.
03Automatically loading API keys or project configuration into the environment when a session starts.