creating-claude-hooks

creating-claude-hooks is a skill for Claude Code, Codex from AgentWorkforce/relay. It costs 37 tokens per session (2,674 once invoked), scanned A, original, Apache-2.0.

A guide for creating and publishing Claude Code hooks, which are executable programs that run when events occur during a Claude Code session.

In plain words
What is it for?
Use it to build hooks for session starts, submitted prompts, and other supported events, handle JSON input, show messages, return status codes, and package hooks for publication.
Why use it?
It explains the required file format, input and output, event timing, and exit codes so hooks run correctly and can stop an operation when needed.

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

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/agentworkforce/relay/creating-claude-hooks-skill.svg)](https://agentmods.dev/skills/agentworkforce/relay/creating-claude-hooks-skill)
Your own site
<a href="https://agentmods.dev/skills/agentworkforce/relay/creating-claude-hooks-skill"><img src="https://agentmods.dev/badge/skills/agentworkforce/relay/creating-claude-hooks-skill.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 2,674 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.00037 $0.02674
Opus 5 $0.00018 $0.01337
Sonnet 5 $0.00007 $0.00535
Haiku 4.5 $0.00004 $0.00267

Measured 5d ago against content hash 9c19727c479c, 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 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 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.

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.

.claude/skills/creating-claude-hooks-skill/SKILL.md · 439 lines

How it starts

The opening of the file, as written. The whole thing — 439 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

Hook File Format

Aspect Requirement
Location .claude/hooks/<event-name>
Format Executable file (shell, TypeScript, Python, etc.)
Permissions Must be executable (chmod +x)
Shebang Required (#!/bin/bash or #!/usr/bin/env node)
Input JSON via stdin
Output Text via stdout (shown to user)
Exit Codes 0 = success, 2 = block, other = error

Available Events

Event When It Fires Common Use Cases
session-start New session begins Environment setup, logging, checks
user-prompt-submit Before user input processes Validation, enhancement, filtering
tool-call Before tool execution Permission checks, logging, modification
assistant-response After assistant responds Formatting, logging, cleanup

Hook Format Requirements

File Location

Project hooks:

.claude/hooks/session-start
.claude/hooks/user-prompt-submit

User-global hooks:

~/.claude/hooks/session-start
~/.claude/hooks/tool-call

Read the full file on GitHub · 439 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 · 439 lines · 37 tokens per session scan A 9c19727c479c

Subscribe to this mod's changes

creating-claude-hooks is a skill published in the GitHub repository AgentWorkforce/relay (812 stars, last pushed today), licensed Apache-2.0. It adds 37 tokens to every session and 2,674 once invoked, about $0.0002 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.

Related

Other skills, from other repositories

cost-efficiency-analyzer

Analyzes cost structure, cost efficiency, and expense management from P&L data. Use when the user asks about costs, expenses, COGS, operating expenses, cost ratios, cost control, spending efficiency, margin compression from cost side, or wants to understand where money is going. Also use for "are we spending too…

awslabs/agentcore-samples · 98 tokens

multi-quarter-trend-analysis

Analyzes financial trends across multiple quarters by comparing P&L metrics over time. Use when the user wants to see trends, patterns, trajectories, or directional movement across 3 or more quarters. Also use for "how are we trending", "show me the trend", "track performance over time", "quarter over quarter…

awslabs/agentcore-samples · 82 tokens

sector-rotation

Identify which market sectors to overweight or underweight based on current macro conditions and sector performance data.

awslabs/agentcore-samples · 22 tokens

trend-analysis

Analyze price and volume trends for one or more stocks to determine momentum direction and key technical levels.

awslabs/agentcore-samples · 21 tokens

babysit

Same-session monitoring loop for PRs, CI runs, tickets, and deployments using the monitorstart / monitorupdate / autonudgestop MCP tools. The loop re-injects your check instructions into THIS session on an idle interval — same context, same tools — and works from dashboard chat, Slack threads, and Discord DMs. Use…

kirodotdev/KiroCrew · 137 tokens

persistent-notes

Save notes locally to /mnt/workspace/notes.json file. Use when user wants to "save a note" or "remember something".

awslabs/agentcore-samples · 32 tokens