hook-creator

Generate JSON hook configurations for Claude Code plugin events.

5|Updated Nov 21, 2025
One-click install
npx skills add https://github.com/basher83/agent-auditor --skill hook-creator-basher83
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hook-creator
Source: https://github.com/basher83/agent-auditor/tree/main/skills/hook-creator
Command: npx skills add https://github.com/basher83/agent-auditor --skill hook-creator-basher83

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you automate the creation of hook configurations that respond to Claude Code events automatically, enabling workflow automation such as formatting on save, running tests after edits, or session initialization.

Core Features & Use Cases

  • Event-driven hooks: Define events (PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd) and corresponding actions.
  • Hook types: Support for command, validation, and notification hooks.
  • Guidance & structure: Provides templates and examples to ensure correct hooks.json structure and safe paths using ${CLAUDE_PLUGIN_ROOT}.

Quick Start

Create a PostToolUse hook that runs a code formatter script: ${CLAUDE_PLUGIN_ROOT}/scripts/format-code.sh on edits.

Frequently Asked Questions about hook-creator

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

FAQPage Schema
How do I automate event-driven actions in Claude Code plugins using hooks?

Event-driven hooks respond to Claude Code events like PreToolUse, PostToolUse, SessionStart, SessionEnd, and UserPromptSubmit by executing commands, validating input, or sending notifications. Define these in hooks.json with script paths under scripts/ and use ${CLAUDE_PLUGIN_ROOT} for portable references to automate workflows such as formatting on save or running tests after edits.

What events can I trigger hooks on in Claude Code?

Claude Code supports five core hook events: PreToolUse and PostToolUse for tool execution, SessionStart and SessionEnd for session lifecycle, and UserPromptSubmit for user input. Each event can execute commands, perform validation, or send notifications as defined in your hooks.json configuration.

How do I structure a hooks.json configuration file correctly?

hooks.json uses a JSON schema defining events, corresponding actions (command, validation, or notification), and script paths. Scripts must reside in scripts/ and reference portable paths via ${CLAUDE_PLUGIN_ROOT} for cross-platform compatibility. Follow the official schema to ensure robust error handling and alignment with Claude Code documentation.

Can I run multiple actions when a single event fires?

hooks.json supports defining multiple hook configurations per event, enabling sequential or parallel command execution, validation checks, and notifications in response to a single Claude Code event like PostToolUse or SessionStart.

What are the limitations of hook-based automation in Claude Code?

Hook actions are constrained to command execution, validation logic, and notifications tied to predefined Claude Code events. Complex multi-stage workflows or external API integrations require scripts placed in scripts/ that hooks invoke; error handling must align with official Claude Code documentation standards.

Why use hooks.json instead of manual plugin configuration?

hooks.json automates event responses declaratively, eliminating manual intervention for recurring tasks like auto-formatting and test runs. This JSON-based approach ensures portable, version-controlled configurations and reduces setup friction across Claude Code plugin deployments.