creating-claude-hooks

creating-claude-hooks is a skill for Claude Code, Codex from pr-pm/prpm. It costs 37 tokens per session (4,053 once invoked), scanned A, original, MIT.

A guide for creating Claude Code hooks, which are actions triggered by events such as tool use or other workflow points. It explains command and prompt hooks, their input and output, exit codes, security, and package layout.

In plain words
What is it for?
Use it to create, improve, publish, or troubleshoot Claude Code hooks and to decide whether a hook, skill, or command fits a workflow.
Why use it?
It removes guesswork about hook configuration, event handling, and the difference between fast scripts and hooks that use language-model reasoning.

Skill for Claude CodeCodex

Installs and runs on its own, but its text points at files inside the plugin that ships it — anything it tells you to read at a ${CLAUDE_PLUGIN_ROOT} path is only there once the plugin is installed.

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 skills/pr-pm/prpm/creating-claude-hooks
Any agent
npx skills add pr-pm/prpm --skill creating-claude-hooks
Clone the repo
git clone --depth 1 https://github.com/pr-pm/prpm

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for creating-claude-hooks

README.md
[![agentmods](https://agentmods.dev/badge/skills/pr-pm/prpm/creating-claude-hooks.svg)](https://agentmods.dev/skills/pr-pm/prpm/creating-claude-hooks)
Your own site
<a href="https://agentmods.dev/skills/pr-pm/prpm/creating-claude-hooks"><img src="https://agentmods.dev/badge/skills/pr-pm/prpm/creating-claude-hooks.svg" alt="Measured on agentmods" height="20"></a>
Per session 37 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,053 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00037 $0.04053
Opus 5 $0.00018 $0.02027
Sonnet 5 $0.00007 $0.00811
Haiku 4.5 $0.00004 $0.00405

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

Security

Grade A, and why

creating-claude-hooks scanned grade A with 1 finding 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 5d 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.

Reads agent configuration directorieslowAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

- Configure in `.claude/settings.json`, `~/.claude/settings.json`, or plugin's `hooks.json`

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

.claude/skills/creating-claude-hooks/SKILL.md · 686 lines

How it starts

The opening of the file, as written. The whole thing — 686 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Creating Claude Code Hooks

Use this skill when creating, improving, or publishing Claude Code hooks. Provides essential guidance on hook format, event handling, I/O conventions, and package structure.

When to Use This Skill

Activate this skill when:

  • User asks to create a new Claude Code hook
  • User wants to publish a hook as a PRPM package
  • User needs to understand hook format or events
  • User is troubleshooting hook execution
  • User asks about hook vs skill vs command differences

Quick Reference

Two Hook Configuration Methods

Method 1: JSON Configuration (Recommended)

  • Configure in .claude/settings.json, ~/.claude/settings.json, or plugin's hooks.json
  • Supports both command hooks and prompt hooks
  • More flexible, supports matchers and timeouts

Method 2: Executable Files (Legacy)

  • Place executables in .claude/hooks/<event-name>
  • Simpler but less configurable

Hook Types

Type Description Speed Use Case
Command Runs external script Fast (ms) Formatting, logging, file checks
Prompt Uses LLM reasoning Slow (2-10s) Complex validation, security analysis

Available Events

Event When It Fires Can Block? Common Use Cases
PreToolUse Before tool execution Yes (exit 2) Validation, permission checks, input modification
PostToolUse After tool completes No Formatting, logging, cleanup
UserPromptSubmit Before user input processes Yes Prompt validation, enhancement
SessionStart New session begins No Environment setup, context loading
Stop When assistant finishes No Cleanup, summary, verification
SubagentStop When subagent finishes No Subagent result processing
PreCompact Before context compaction No Save important context
Notification During alerts No Desktop notifications, logging
PermissionRequest When permission needed Yes Custom permission handling

Read the full file on GitHub · 686 lines

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. 5d ago First seen · 686 lines · 37 tokens per session scan A 75539983f4a4

Subscribe to this mod's changes

creating-claude-hooks is a skill published in the GitHub repository pr-pm/prpm (120 stars, last pushed 2mo ago), licensed MIT. It adds 37 tokens to every session and 4,053 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.