create-hook

A command for creating and managing Claude Code hooks, which run actions around tool use or permission checks.

In plain words
What is it for?
Use it to create, validate, analyse, debug, or inspect hooks such as command validators and permission handlers.
Why use it?
It supplies templates and checks for conflicts or invalid configurations, reducing manual setup and debugging.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/hwells4/create-hooks/create-hook
Clone the repo
git clone --depth 1 https://github.com/hwells4/create-hooks
Per session 14 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 329 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00014 $0.00329
Opus 5 $0.00007 $0.00164
Sonnet 5 $0.00003 $0.00066
Haiku 4.5 $0.00001 $0.00033

Measured 2d ago against content hash f4996d752740, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

create-hook scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/create-hook.md · 53 lines

What it actually says

/create-hook

Create and manage Claude Code hooks with proper templates, validation, and conflict analysis.

Usage

/create-hook                        # Interactive mode
/create-hook new PreToolUse         # Create a new hook for an event
/create-hook new PreToolUse validate-bash  # Create with specific name
/create-hook debug my-hook.py       # Debug an existing hook
/create-hook analyze                # Analyze existing hooks for conflicts
/create-hook validate               # Validate all hook configurations
/create-hook validate my-hook.py    # Validate specific hook
/create-hook template auto-approve  # Show a template

Examples

# Create a hook that validates bash commands
/create-hook new PreToolUse bash-validator

# Create a hook for auto-approving safe operations
/create-hook new PermissionRequest auto-approve

# Analyze what hooks are already installed
/create-hook analyze

# Debug a hook that isn't working
/create-hook debug hooks/my-validator.py

Hook Events

Event When Can Block?
PreToolUse Before tool runs Yes
PostToolUse After tool succeeds Feedback only
PermissionRequest Permission dialog Yes
UserPromptSubmit User sends prompt Yes
Stop Claude finishes Yes (continue)
SessionStart Session begins Context + env vars
SessionEnd Session ends Cleanup only

Invoke the create-hook skill for: $ARGUMENTS

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 53 lines · 14 tokens per session scan A f4996d752740

Subscribe to this mod's changes

create-hook is a command published in the GitHub repository hwells4/create-hooks (21 stars, last pushed 2mo ago), licensed MIT. It adds 14 tokens to every session and 329 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.