creating-hooks

Generate structured semantic metadata from Skill Units for vector-based RAG systems.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/BrendanShields/spec-flow --skill creating-hooks-brendanshields
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: creating-hooks
Source: https://github.com/BrendanShields/spec-flow/tree/main/plugins/spec/skills/creating-hooks
Command: npx skills add https://github.com/BrendanShields/spec-flow --skill creating-hooks-brendanshields

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you create Claude Code hooks to automate events within Claude Code workflows, reducing manual setup time and repetitive configuration.

Core Features & Use Cases

  • Define hook events (PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, Stop) and their behavior.
  • Configure hook scripts and hook wiring in settings.json using templates from the templates/ directory.
  • Automate common workflows such as logging, context injection, and validation at key moments to speed up development.

Quick Start

  1. Select a hook event to automate (e.g., PreToolUse or SessionStart).
  2. Create or customize a hook script in templates/ and reference it in your settings.json.
  3. Add the hook configuration to .claude/settings.json.
  4. Test the hook with a sample JSON input, e.g. echo '{"hook_event_name":"PreToolUse","tool_name":"Write"}' | bash ".claude/hooks/my-hook.sh"

Frequently Asked Questions about creating-hooks

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

FAQPage Schema
How do I automate Claude Code workflows with hooks?

Hooks automate tasks at key workflow moments—PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, Stop—by running scripts you define in settings.json. Create a hook script, reference it in .claude/settings.json, and it executes automatically when that event fires, eliminating manual setup.

What hook events can I trigger in Claude Code?

Claude Code supports six hook events: PreToolUse and PostToolUse (before/after tool execution), UserPromptSubmit (on user input), SessionStart and SessionEnd (workflow lifecycle), and Stop (interruption). Each fires at a specific workflow moment where you can inject logging, validation, or context.

How do I configure hooks in settings.json?

Add hook configuration to .claude/settings.json with the hook event name and script path. Use templates from the templates/ directory as starting points, then test with sample JSON input: echo '{"hook_event_name":"PreToolUse","tool_name":"Write"}' | bash ".claude/hooks/my-hook.sh".

What workflows can hooks automate?

Hooks reduce repetitive configuration by automating logging (track tool calls), context injection (add data at key moments), and validation (check inputs before execution). Common use cases include auditing workflows, dynamically enriching prompts, and enforcing guardrails.

Do I need scripting knowledge to create hooks?

Yes—hooks require writing or customizing scripts that accept JSON input matching the hook event structure. Templates provide starting points, but you need to understand how to parse JSON and define logic for your automation scenario.

Can I use hooks to validate tool inputs before execution?

Yes. PreToolUse hooks execute before a tool runs, so you can inspect the tool name and parameters, log them, validate against rules, or inject context. PostToolUse hooks run after execution to process or transform tool output.