create-hook

Add event hooks to a plugin's hooks.json configuration.

Updated Dec 9, 2025
One-click install
npx skills add https://github.com/blueif16/amazing-claude-code-plugins --skill create-hook
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-hook
Source: https://github.com/blueif16/amazing-claude-code-plugins/tree/main/skillforge/skills/create-hook
Command: npx skills add https://github.com/blueif16/amazing-claude-code-plugins --skill create-hook

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill removes the complexity of manually editing JSON files to add event hooks to your plugins.

Core Features & Use Cases

  • Event Hook Management: Add hooks for tool usage, permission requests, notifications, and more.
  • Pattern Matching: Configure hooks to trigger only for specific tools or all tools.
  • Use Case: When you want to automatically format code after editing, use this Skill to add a PostToolUse hook for Write and Edit tools.

Quick Start

Run the create-hook skill to add an auto-format hook that runs prettier after file edits.

Quick Start

Run the create-hook skill to add a PostToolUse hook for Write|Edit tools with the command 'prettier --write $FILE'.

Frequently Asked Questions about create-hook

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

FAQPage Schema
How do I add event hooks to a Claude plugin's hooks.json?

Event hooks are automation triggers that run code at specific points in a plugin's lifecycle—before or after tool use, during permission requests, or on notifications. Use the create-hook Skill to add a hook by specifying the event type (PreToolUse, PostToolUse, PermissionRequest, UserPromptSubmit, Notification, Stop, or SubagentStop), matching pattern, and command. The Skill reads or initializes hooks.json, appends your hook to the correct event array, and writes the file back.

Can I set up a hook to run automatically after file edits?

Yes. Create a PostToolUse hook targeting the Write or Edit tools with a command like 'prettier --write $FILE'. The create-hook Skill handles the pattern matching and JSON configuration, so the hook executes your formatting command every time those tools complete.

What's the difference between hook event types in plugin configuration?

Hook event types define when automation triggers: PreToolUse runs before a tool executes, PostToolUse runs after, PermissionRequest fires during permission checks, UserPromptSubmit on prompt submission, Notification on alerts, and Stop/SubagentStop on agent halting. Choose the type based on when you need your command to run in the tool workflow.

Do I need to manually edit JSON to add multiple hooks?

No. The create-hook Skill removes manual JSON editing by managing the hooks.json file directly. It reads the existing structure, appends your new hook to the appropriate event array, and writes it back, so you add multiple hooks through repeated Skill invocations without touching the file.

Can hooks match specific tools or do they trigger globally?

Hooks use pattern matching to target specific tools or apply globally. Configure the matching pattern when creating a hook—use a tool name like 'Write' or 'Edit' for selective triggering, or set a pattern that applies to all tools, depending on your automation use case.

What happens if hooks.json doesn't exist when I add a hook?

The create-hook Skill initializes a new hooks.json file if it's missing, then appends your hook to the correct event array. You don't need to create the file manually; the Skill handles setup and writes a valid plugin hook configuration.