hooks-reference

hooks-reference is a skill for Claude Code, Codex from a-ariff/ariff-claude-plugins. It costs 52 tokens per session (2,451 once invoked), scanned C, original, MIT.

A reference guide for Claude Code hooks, which are event handlers that run around agent actions or sessions.

In plain words
What is it for?
It is for implementing hooks such as checks before or after tool use, context loading at session start, permission handling, and verification when work stops.
Why use it?
It explains when automated checks or other actions can run, so developers can validate, block, audit, or add context at the right time.

Skill for Claude CodeCodex

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

Part of the hooks-reference plugin — 1 skill shipped together

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/a-ariff/ariff-claude-plugins/hooks-reference
Any agent
npx skills add a-ariff/ariff-claude-plugins --skill hooks-reference
Clone the repo
git clone --depth 1 https://github.com/a-ariff/ariff-claude-plugins

Made for: Claude Code, Codex.

Or install hooks-reference, the plugin that ships this one along with the rest of its 1 skill.

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 hooks-reference

README.md
[![agentmods](https://agentmods.dev/badge/skills/a-ariff/ariff-claude-plugins/hooks-reference.svg)](https://agentmods.dev/skills/a-ariff/ariff-claude-plugins/hooks-reference)
Your own site
<a href="https://agentmods.dev/skills/a-ariff/ariff-claude-plugins/hooks-reference"><img src="https://agentmods.dev/badge/skills/a-ariff/ariff-claude-plugins/hooks-reference.svg" alt="Measured on agentmods" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,451 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 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.00052 $0.02451
Opus 5 $0.00026 $0.01226
Sonnet 5 $0.00010 $0.00490
Haiku 4.5 $0.00005 $0.00245

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

Security

Grade C, and why

hooks-reference scanned grade C 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 4d 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

"rm -rf /"
plugins/hooks-reference/skills/hooks-reference/SKILL.md · 430 lines

How it starts

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

Hooks Reference Skill

This skill provides comprehensive guidance for implementing Claude Code hooks - event handlers that automate validation, context loading, and workflow enforcement.

Hook Events Overview

Event When Triggered Use Cases
PreToolUse Before tool executes Validate, block, modify
PostToolUse After tool completes Audit, react, verify
PermissionRequest Permission dialog shown Auto-allow, auto-deny
Stop Claude finishes Force continue, verify
SubagentStop Subagent finishes Verify task complete
SessionStart Session begins Load context, setup
SessionEnd Session ends Cleanup, save state
UserPromptSubmit Prompt submitted Validate, add context
PreCompact Before compaction Preserve info
Notification Notification sent Alert, log

hooks.json Structure

Basic structure:

{
  "description": "What these hooks do",
  "hooks": {
    "EventName": [
      {
        "matcher": "Pattern",
        "hooks": [
          {
            "type": "command",
            "command": "${CLAUDE_PLUGIN_ROOT}/scripts/handler.sh",
            "timeout": 30
          }
        ]
      }
    ]
  }
}

Matcher Patterns

For tool events (PreToolUse, PostToolUse, PermissionRequest):

  • "Write" - Match exact tool name
  • "Write|Edit" - Match multiple tools (regex)
  • "Notebook.*" - Regex pattern
  • "*" or "" - Match all tools

For SessionStart:

  • "startup" - Initial startup
  • "resume" - From --resume, --continue, /resume
  • "clear" - From /clear
  • "compact" - From auto/manual compact

For Notification:

  • "permission_prompt" - Permission requests
  • "idle_prompt" - Claude waiting for input

Hook Types

Command Hooks (type: "command")

Execute a bash script:

{
  "type": "command",
  "command": "${CLAUDE_PLUGIN_ROOT}/scripts/validate.sh",
  "timeout": 30
}

Prompt Hooks (type: "prompt")

LLM-based evaluation (Stop, SubagentStop only):

{
  "type": "prompt",
  "prompt": "Evaluate if Claude should stop: $ARGUMENTS. Check if all tasks are complete.",
  "timeout": 30
}

Read the full file on GitHub · 430 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. 4d ago First seen · 430 lines · 52 tokens per session scan C 8766eed8bfff

Subscribe to this mod's changes

hooks-reference is a skill published in the GitHub repository a-ariff/ariff-claude-plugins (14 stars, last pushed 5mo ago), licensed MIT. It adds 52 tokens to every session and 2,451 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.