hooks

hooks is a skill for Claude Code from nimadorostkar/Claude-Skills-collection. It costs 95 tokens per session (1,259 once invoked), scanned C, original, MIT.

A system for running automatic actions at points in an AI agent's lifecycle, such as before or after a tool call, when a session starts, or when it stops. These actions can enforce rules, add context, log activity, or block unsafe commands.

In plain words
What is it for?
Use it to run checks around edits or commands, prevent dangerous actions, inject information at the right time, and automate notifications or logging.
Why use it?
It makes important rules happen reliably instead of depending on the agent to remember them every time. This is useful for required checks, formatting, safety controls, and repeated setup steps.

Skill for Claude Code

Written for Claude Code: PostToolUse hook event.

Part of the agent-tooling plugin — 8 skills shipped together

Good fit Use it to run checks around edits or commands, prevent dangerous actions, inject information at the right time, and automate notifications or logging.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/nimadorostkar/claude-skills-collection/hooks
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.

Any agent
npx skills add nimadorostkar/Claude-Skills-collection --skill hooks
Clone the repo
git clone --depth 1 https://github.com/nimadorostkar/Claude-Skills-collection

Made for: Claude Code.

Or install agent-tooling, the plugin that ships this one along with the rest of its 8 skills.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/nimadorostkar/claude-skills-collection/hooks/github.svg)](https://agentmods.dev/skills/nimadorostkar/claude-skills-collection/hooks)
Your own site
<a href="https://agentmods.dev/skills/nimadorostkar/claude-skills-collection/hooks"><img src="https://agentmods.dev/badge/skills/nimadorostkar/claude-skills-collection/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 hooks

Your own site · 80×15
<a href="https://agentmods.dev/skills/nimadorostkar/claude-skills-collection/hooks"><img src="https://agentmods.dev/badge/skills/nimadorostkar/claude-skills-collection/hooks.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 95 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,259 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. 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.00095 $0.01259
Opus 5.5 $0.00038 $0.00504
Sonnet 5.5 $0.00019 $0.00252
Haiku 4.5 $0.00010 $0.00126

Measured 1mo ago against content hash 0abad40a5006, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade C, and why

hooks 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 1mo 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.

description: Use when automating agent behavior with lifecycle hooks. Covers hook events, deterministic enforcement of rules the model should not be trusted to remember, and avoiding hooks that make an agent unusable. Tr
skills/agent-tooling/hooks/SKILL.md · 115 lines

How it starts

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

Hooks

Purpose

Enforce a rule deterministically rather than asking the model to remember it. A hook runs every time, regardless of the model's attention, its context, or its mood — which is exactly what a rule requires.

When to Use

  • A rule must hold every time: formatting, a forbidden command, a required check.
  • The agent keeps forgetting an instruction despite it being in the instructions.
  • Automating a step that should happen around every edit or command.
  • Blocking a dangerous action before it executes.

Capabilities

  • Lifecycle events: before and after a tool call, on session start, on stop.
  • Deterministic enforcement: formatting, linting, blocking.
  • Injecting context at the right moment.
  • Notification and logging.

Inputs

  • The rule and when it must apply.
  • The event that should trigger it.
  • What should happen when it fails: block, warn, or fix.

Outputs

  • Hook configuration that runs reliably.
  • Rules enforced without depending on the model's memory.
  • A fast hook — one that does not make the agent unpleasant to use.

Workflow

  1. Identify the rule that keeps being broken — If an instruction is in the instruction file and is still violated, it is a hook, not an instruction. Instructions are guidance; hooks are enforcement.
  2. Choose the event — Before a tool call to block or validate; after one to format or verify; on session start to inject context.
  3. Make it fast — A hook runs on every matching event. Two seconds on every file edit is a hostile environment. Under 500ms, or run it asynchronously.
  4. Fail informatively — A hook that blocks must say why and what to do instead. A silent block is maddening and the model cannot recover from it.
  5. Prefer fixing over blocking — A hook that formats the file is better than one that rejects the edit and demands the model format it.
  6. Test the hook itself — A broken hook blocks everything, and the failure mode is confusing.

Best Practices

  • A rule the model must remember is a rule the model will eventually forget. If it matters, enforce it in a hook.
  • Do not put slow operations in a synchronous hook. A full test suite on every edit is a way to make the agent unusable.
  • Blocking hooks must explain themselves. exit 2 with an explanatory message on stderr is what lets the model correct course.
  • Match narrowly. A hook that fires on every tool call, including reads, wastes time on operations it does not care about.
  • Auto-formatting after an edit is the single most valuable hook: it removes an entire class of diff noise and lint failures for free.
  • Guard against the destructive command (rm -rf, a force push, a production deploy) in a pre-tool hook. This is cheap insurance.

Read the full file on GitHub · 115 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. 1mo ago Changed · +56 tokens per session 0abad40a5006
  2. 3mo ago First seen · 115 lines · 39 tokens per session scan C b71372eccacb

Subscribe to this mod's changes

hooks is a skill published in the GitHub repository nimadorostkar/Claude-Skills-collection (41 stars, last pushed today), licensed MIT. It adds 95 tokens to every session and 1,259 once invoked, about $0.0004 per session on Opus 5.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.

Related

hooks compared with skills from other repositories

hooks next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
hooksnimadorostkar/Claude-Skills-collectionSkill41todayMITC95Claude Code
offensive-c2-frameworksSnailSploit/Claude-RedSkill12k13d agoMITA250Claude Code, Codex
offensive-crypto-attacksSnailSploit/Claude-RedSkill12k13d agoMITA261Claude Code, Codex
offensive-parameter-pollutionSnailSploit/Claude-RedSkill12k13d agoMITA57Claude Code, Codex
offensive-z-waveSnailSploit/Claude-RedSkill12k13d agoMITA113Claude Code, Codex
fiscalisteromainsimon/paperasseSkill2.6k17d agoMITA306Claude Code
feature-prioritisationmohitagw15856/pm-claude-skillsSkill1.6ktodayMITA103Claude Code, Codex