claude-hooks

claude-hooks is a skill for Claude Code from vinnie357/claude-skills. It costs 48 tokens per session (1,734 once invoked), scanned D, original, MIT.

A guide to Claude Code hooks, which are commands or prompts run when events such as starting a session or using a tool occur.

In plain words
What is it for?
Use it to create hooks, block risky tool calls, add information at session start, or troubleshoot hook configuration.
Why use it?
It helps you configure automatic checks and context injection without guessing where hook settings belong or how they are structured.

Skill for Claude Code

Written for Claude Code: SessionStart hook event. Also seen: reads .claude/ paths; mentions subagents; mentions Claude Code.

Runs only inside its plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else. Install the plugin, not this.

Part of the claude-code plugin — 12 skills, 2 commands shipped together

Good fit Use it to create hooks, block risky tool calls, add information at session start, or troubleshoot hook configuration.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.

Claude Code
/plugin marketplace add vinnie357/claude-skills
Claude Code
/plugin install claude-code

Made for: Claude Code.

Or install claude-code, the plugin that ships this one along with the rest of its 12 skills, 2 commands.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/vinnie357/claude-skills/claude-hooks/github.svg)](https://agentmods.dev/skills/vinnie357/claude-skills/claude-hooks)
Your own site
<a href="https://agentmods.dev/skills/vinnie357/claude-skills/claude-hooks"><img src="https://agentmods.dev/badge/skills/vinnie357/claude-skills/claude-hooks/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for claude-hooks

Your own site · 80×15
<a href="https://agentmods.dev/skills/vinnie357/claude-skills/claude-hooks"><img src="https://agentmods.dev/badge/skills/vinnie357/claude-skills/claude-hooks.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 48 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,734 The whole file, excluding the scripts and references it only reads on demand.
Security scan D 2 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00048 $0.01734
Opus 5 $0.00024 $0.00867
Sonnet 5 $0.00010 $0.00347
Haiku 4.5 $0.00005 $0.00173

Measured 4d ago against content hash ec2fbe1baae4, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade D, and why

claude-hooks scanned grade D with 2 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 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.

Reads agent configuration directoriesmediumAgent snooping

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

| User | `~/.claude/settings.json` under `hooks` | Personal automation across all projects |

Recursive force deletehighDestructive command

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

- Block destructive patterns in `PreToolUse` Bash hooks (`rm -rf /`, `dd if=`, force-push to protected branches).
plugins/tools/claude-code/skills/claude-hooks/SKILL.md · 162 lines

How it starts

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

Claude Code Hooks

Hooks are shell commands or prompts that Claude Code executes in response to events. They are the only mechanism that can compel behavior — Claude reads memory and skills as guidance, but the harness runs hooks, not Claude.

Hook Configuration Locations

Scope Path Use case
User ~/.claude/settings.json under hooks Personal automation across all projects
Project <project>/.claude/settings.json under hooks Repo-shared automation
Plugin <plugin-root>/hooks/hooks.json Distribute hooks via plugin install
Skill/Subagent Skill or subagent frontmatter hooks: field Hooks registered by a skill or subagent invocation

Plugin hooks at <plugin-root>/hooks/hooks.json are auto-discovered. No registration in plugin.json required.

Skill hooks: Claude Code registers them when you or Claude invoke the skill and keeps running them for the rest of the session, on turns after the skill's own turn as well. The practical consequence: the coverage gap is a session that never invokes the skill, not a session where the skill merely "isn't loaded" at the moment a tool runs.

Plugin Hook File Structure

Plugin hooks/hooks.json uses the wrapper format — see references/hook-examples.md ("Plugin hooks.json wrapper format") for the complete file.

  • description — optional, surfaced in plugin metadata
  • hooks — required wrapper containing event arrays
  • matcher — regex of tool names (PreToolUse/PostToolUse) or session lifecycle phases (SessionStart)
  • CLAUDE_PLUGIN_ROOT — absolute path to the plugin root, expanded at runtime. Written bare here (not as ${...}) because the braced form itself expands when this skill loads — see references/hook-examples.md for the real brace-expansion usage.

Hook Events

Event When it fires Common use
SessionStart Session start, resume, clear Inject binding context to turn 1
SessionEnd Session ends Cleanup, telemetry
UserPromptSubmit User submits a prompt Augment prompt, log interaction
PreToolUse Before a tool executes Block dangerous calls, validate input
PostToolUse After a tool completes Format, lint, sync, log
Stop Agent finishes responding Enforce completion standards
SubagentStop Spawned subagent finishes Subagent-specific cleanup
PreCompact Before context compaction Inject context to preserve
Notification A notification fires Custom notification routing

Read the full file on GitHub · 162 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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 Changed · +2 lines ec2fbe1baae4
  2. 7d ago First seen · 160 lines · 48 tokens per session scan D c2ab12002418

Subscribe to this mod's changes

claude-hooks is a skill published in the GitHub repository vinnie357/claude-skills (25 stars, last pushed yesterday), licensed MIT. It adds 48 tokens to every session and 1,734 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it D with 2 findings (reads agent configuration directories, recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

local-ai-agents

Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…

microsoft/ai-agents-for-beginners · 200 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

insight-error-page

Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new errors/ .mdx page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification…

vercel/next.js · 83 tokens

next-cache-components-optimizer

Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…

vercel/next.js · 170 tokens

next-partial-prefetching-adoption

Turn on Partial Prefetching in a Next.js app and work through the insights it surfaces. Use when the user wants to enable or adopt Partial Prefetching, flip the partialPrefetching flag, opt routes in with export const prefetch = 'partial', audit Link prefetch={true} behavior, preserve existing prefetched UI with…

vercel/next.js · 103 tokens