hooks-test

Orchestrate pre- and post-execution hooks around tool use in Claude Agent workflows.

19|3|Updated Jan 13, 2026
One-click install
npx skills add https://github.com/louloulin/claude-agent-sdk --skill hooks-test
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hooks-test
Source: https://github.com/louloulin/claude-agent-sdk/tree/main/crates/claude-agent-sdk/examples/.claude/skills/hooks-test-skill
Command: npx skills add https://github.com/louloulin/claude-agent-sdk --skill hooks-test

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a ready-to-use demonstration of an event-driven hooks system that injects pre-execution, post-execution, and stop-time hooks around tool usage in Claude Agent SDK workflows.

Core Features & Use Cases

  • PreToolUse hooks run before a tool is executed, enabling validation, setup, and contextual preparation.
  • PostToolUse hooks run after a tool completes, enabling logging, auditing, and results aggregation.
  • Stop hooks run when the skill session ends to clean up resources and finalize state.
  • Supports pattern matching by tool name and per-hook configuration, including once-per-session behavior.

Quick Start

To see the hooks in action, trigger a small workflow that calls a Bash tool or a simulated tool. Observe the PreToolUse messages before execution, the PostToolUse messages after completion, and the Stop hook on termination. You can modify the YAML in the SKILL.md to add more tools or adjust matcher patterns.

Frequently Asked Questions about hooks-test

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

FAQPage Schema
How do I run pre-execution and post-execution hooks around tool usage in Claude Agent workflows?

PreToolUse and PostToolUse hooks orchestrate actions around tool execution in Claude Agent workflows. PreToolUse handles validation and setup before execution, while PostToolUse handles logging, auditing, and results aggregation after a tool completes.

What is a Stop hook in event-driven automation and when does it trigger?

A Stop hook in event-driven automation triggers when the skill session ends to clean up resources and finalize state. It is defined in YAML configuration alongside PreToolUse and PostToolUse hooks to manage the complete lifecycle of tool execution.

Can I use pattern matching to trigger hooks for specific tools in a Claude Agent session?

Yes, hooks support pattern matching by tool name through YAML-defined matcher patterns. You can configure per-hook commands to trigger only for specific tools, including setting once-per-session behavior for efficient event-driven automation.

How do I configure YAML hooks for PreToolUse, PostToolUse, and Stop events?

You configure YAML hooks by defining pre_tool_use, post_tool_use, and stop sections with matcher patterns and per-hook commands. Modify the YAML in the SKILL.md to add tools or adjust matcher patterns to customize the event-driven workflow.

What's the best way to test event-driven hooks for tool execution without a complex setup?

Trigger a small workflow that calls a Bash tool or simulated tool to observe hooks in action. Watch for PreToolUse messages before execution, PostToolUse messages after completion, and Stop hook messages on session termination to verify the event-driven lifecycle.

Why do I need hooks for tool execution if my automation workflow already handles errors?

Hooks provide structured preparation, auditing, and cleanup around tool usage that general error handling lacks. PreToolUse enables contextual validation before execution, PostToolUse captures results aggregation, and Stop ensures resource cleanup when sessions end.