creating-claude-hooks
Use when creating or publishing Claude Code hooks - covers executable format, event types, JSON I/O, exit codes, security requirements, and PRPM package structure
npx skills add AgentWorkforce/relay --skill creating-claude-hooks-skill --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# 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 s
- When to Use This Skill
- Quick Reference
- Hook File Format
- Available Events
- Hook Format Requirements
- File Location
- Executable Requirements
- Input/Output Format
- JSON Input Structure
- Stdout Output
- Exit Codes
- Schema Validation
- Common Mistakes
- Basic Hook Examples
or chmod +x .claude/hooks/session-start exit 0 # Success exit 2 # Block operation exit 1 # Error (logs but continues) Log session start echo "Session started at $(date)" >> ~/.claude/session.log Check environment if ! command -v node &> /dev/null; then echo "Warning: Node.js not installed" >&2
What does the creating-claude-hooks skill do?
Use when creating or publishing Claude Code hooks - covers executable format, event types, JSON I/O, exit codes, security requirements, and PRPM package structure
How do I install it?
Run `npx skills add AgentWorkforce/relay --skill creating-claude-hooks-skill --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From AgentWorkforce/relay, a repository with 784 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
