Getting it into your agent
There is no command for this one: it runs only inside a plugin, and the catalogue could not identify which plugin ships it. The source is linked below.
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.
[](https://agentmods.dev/skills/pr-pm/prpm/claude-hook-writer)<a href="https://agentmods.dev/skills/pr-pm/prpm/claude-hook-writer"><img src="https://agentmods.dev/badge/skills/pr-pm/prpm/claude-hook-writer.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00033 | $0.05522 |
| Opus 5 | $0.00016 | $0.02761 |
| Sonnet 5 | $0.00007 | $0.01104 |
| Haiku 4.5 | $0.00003 | $0.00552 |
Grade A, and why
claude-hook-writer 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 6d 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.
How it starts
The opening of the file, as written. The whole thing — 969 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Claude Hook Writer
Use this skill when creating or improving Claude Code hooks. This skill ensures hooks are secure, reliable, performant, and follow best practices.
When to Use This Skill
- Designing a new Claude Code hook
- Reviewing existing hook code
- Debugging hook failures
- Optimizing slow hooks
- Securing hooks that handle sensitive data
- Publishing hooks as PRPM packages
Core Principles
1. Security is Non-Negotiable
Hooks execute automatically with user permissions. They can read, modify, or delete any file the user can access.
ALWAYS validate and sanitize all input. Hooks receive JSON via stdin—never trust it blindly.
2. Reliability Over Features
A hook that works 99% of the time is a broken hook. Edge cases (Unicode filenames, spaces in paths, missing tools) will happen.
Test with edge cases before deploying.
3. Performance Matters
Hooks block operations. A 5-second hook means Claude waits 5 seconds before continuing.
Keep hooks fast. Run heavy operations in background.
4. Fail Gracefully
Missing dependencies, malformed input, and disk errors will occur.
Handle errors explicitly. Log failures. Return meaningful exit codes.
Hook Design Checklist
Before writing code, answer these questions:
What Event Does This Hook Target?
PreToolUse- Before tool execution (modify input, validate, block)PostToolUse- After tool completes (format, log, cleanup)UserPromptSubmit- Before user input processes (validate, enhance)SessionStart- When Claude Code starts (setup, env check)SessionEnd- When Claude Code exits (cleanup, persist state)Notification- During alerts (desktop notifications, logging)Stop/SubagentStop- When responses finish (cleanup, summary)PreCompact- Before context compaction (save important context)
Common mistake: Using PostToolUse for validation (too late—tool already ran). Use PreToolUse to block operations.
Which Tools Should Trigger This Hook?
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.
- 6d ago First seen · 969 lines · 33 tokens per session scan A f290d66b01f6
claude-hook-writer is a skill published in the GitHub repository pr-pm/prpm (120 stars, last pushed 2mo ago), licensed MIT. It adds 33 tokens to every session and 5,522 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.
Other skills, from other repositories
dependency-analysis
This rule automatically analyzes dependencies before they're installed to provide insights about maintenance frequency, security vulnerabilities, and popularity in the developer ecosystem.
biome
Biome JavaScript/TypeScript linter and formatter.
laravel
Laravel PHP framework best practices.
nextjs-react19
Next.js with React 19 App Router patterns.
template-helpers
Catalog of the reusable building blocks shipped with this Android template — BaseActivity/BaseFragment, the helpers/ extension files (navigation, lifecycle, toast, snackbar, dialogs, images, permissions, theme, locale, settings intents, date, delay), common/ (Firebase, network, observers), and…
android-new-project
Workflow for turning a fresh copy of this Android template into a new app — renaming the package/namespace/applicationId, branding (icons, splash, palette, fonts), Firebase setup, signing config, stripping unused sample screens, and verifying the foundation. Use when the user says they are starting a new app…