hook-development

Implement executable shell script hooks for Claude Code plugin events.

Updated Feb 5, 2026
One-click install
npx skills add https://github.com/TomazWang/agent-toolkit --skill hook-development-tomazwang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hook-development
Source: https://github.com/TomazWang/agent-toolkit/tree/main/plugins/plugin-creator/skills/hook-development
Command: npx skills add https://github.com/TomazWang/agent-toolkit --skill hook-development-tomazwang

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Hooks enable event-driven automation for Claude Code plugins by reacting to lifecycle events and tool interactions.

Core Features & Use Cases

  • Support for multiple hook events (PreToolUse, PostToolUse, SessionStart, SessionEnd, Stop, SubagentStop, UserPromptSubmit, PreCompact, Notification).
  • Provide example hook templates and patterns for validation, logging, and automation.
  • Guidance on making hooks executable, environment variable usage, and best practices.

Quick Start

Create and customize executable hooks for PreToolUse, PostToolUse, and SessionStart events.

Frequently Asked Questions about hook-development

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

FAQPage Schema
How do I set up event-driven hooks for Claude Code plugin lifecycle events?

Event-driven hooks for Claude Code plugins require a standardized hooks/ directory containing executable shell scripts. You create specific files like PreToolUse.sh or SessionStart.sh to manage lifecycle events and automated responses using exposed environment variables.

Can I validate tools automatically before or after execution in Claude Code?

Tool validation in Claude Code is handled through PreToolUse and PostToolUse shell script hooks. These executable scripts intercept tool interactions, allowing you to run automated validation logic before or after the tool executes.

What Claude Code session lifecycle events can I trigger shell scripts on?

Claude Code session lifecycle management supports triggering shell scripts on SessionStart, SessionEnd, Stop, SubagentStop, PreCompact, and Notification events. This allows automated logging and responses across the entire session duration.

Does Claude Code hook automation require external dependencies or specific plugin components?

Claude Code hook automation requires no external dependencies or components. It operates using standardized executable shell scripts placed in a hooks/ directory, interacting with exposed environment variables for each event.

What is the best way to log Claude Code tool interactions and user prompts?

Logging Claude Code interactions is best implemented through executable shell scripts for hook events like PostToolUse and UserPromptSubmit. These scripts capture environment variables exposed during the event to automate logging workflows.

How does a PreToolUse hook receive data about the tool it is validating?

PreToolUse hooks receive validation data through environment variables exposed by Claude Code during the event. The executable shell script reads these variables to implement automated pre-execution validation logic.