hook-creator

hook-creator is a skill for Claude Code from softspark/ai-toolkit. It costs 49 tokens per session (2,998 once invoked), scanned A, original, Apache-2.0.

A guide for creating Claude Code lifecycle hooks, which are scripts that run when events such as tool use, session start, or errors occur.

In plain words
What is it for?
Use it to create PreToolUse, PostToolUse, SessionStart, and similar hooks with a hooks.json file and shell scripts.
Why use it?
It helps automate checks, logging, safety rules, and other repeated actions around an agent's work.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions CLAUDE.md; 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 ai-toolkit plugin — 115 skills, 44 agents, 14 hooks shipped together

Good fit Use it to create PreToolUse, PostToolUse, SessionStart, and similar hooks with a hooks.json file and shell scripts.

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 softspark/ai-toolkit
Claude Code
/plugin install ai-toolkit

Made for: Claude Code.

Or install ai-toolkit, the plugin that ships this one along with the rest of its 115 skills, 44 agents, 14 hooks.

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 hook-creator

README.md
[![agentmods](https://agentmods.dev/badge/skills/softspark/ai-toolkit/hook-creator/github.svg)](https://agentmods.dev/skills/softspark/ai-toolkit/hook-creator)
Your own site
<a href="https://agentmods.dev/skills/softspark/ai-toolkit/hook-creator"><img src="https://agentmods.dev/badge/skills/softspark/ai-toolkit/hook-creator/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 hook-creator

Your own site · 80×15
<a href="https://agentmods.dev/skills/softspark/ai-toolkit/hook-creator"><img src="https://agentmods.dev/badge/skills/softspark/ai-toolkit/hook-creator.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,998 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 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.00049 $0.02998
Opus 5.5 $0.00020 $0.01199
Sonnet 5.5 $0.00010 $0.00600
Haiku 4.5 $0.00005 $0.00300

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

Security

Grade A, and why

hook-creator 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 22d 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.

app/skills/hook-creator/SKILL.md · 235 lines

How it starts

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

Hook Creator

$ARGUMENTS

Create a new Claude Code hook following ai-toolkit conventions.

Supported Hook Events

Core lifecycle

Event Fires When Matcher Typical Use
SessionStart Session begins, resumes, or clears startup|resume|clear Context injection, rules reminder
SessionEnd Session is closing any Flush logs, save transcripts
UserPromptSubmit User submits a prompt any Prompt governance, usage tracking
Notification Claude sends a notification any OS alerts, Slack pings
MessageDisplay Assistant message text streams in completed-line batches none Return displayContent to replace the rendered batch without changing the transcript

Tool lifecycle

Event Fires When Matcher Typical Use
PreToolUse Before a tool executes tool name (e.g. Bash) or if: rule Safety guards, validation, "defer" for headless
PostToolUse After a tool executes tool name Feedback loops, logging, format-on-save
PostToolUseFailure After a tool fails tool name Failure telemetry, recovery hints
PostToolBatch After a batch of tool calls completes any Batch summaries, aggregate validation

Turn lifecycle

Event Fires When Matcher Typical Use
Stop Claude finishes responding any Quality checks, session save
StopFailure Turn ends due to an API error (rate limit, auth) any Alerting, fallback behavior
UserPromptExpansion Claude expands or rewrites a submitted prompt any Prompt policy and context shaping

Subagent lifecycle

Event Fires When Matcher Typical Use
SubagentStart Subagent launches any Observability
SubagentStop Subagent completes any Result validation

Compaction

Event Fires When Matcher Typical Use
PreCompact Before context compaction; can block with exit 2 or {"decision":"block"} any Context preservation
PostCompact After compaction completes any Re-inject state that was summarized away

Read the full file on GitHub · 235 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. 22d ago Changed · +15 lines db9574375262
  2. 1mo ago First seen · 220 lines · 49 tokens per session scan A ec2bcc395ef1

Subscribe to this mod's changes

hook-creator is a skill published in the GitHub repository softspark/ai-toolkit (180 stars, last pushed yesterday), licensed Apache-2.0. It adds 49 tokens to every session and 2,998 once invoked, about $0.0002 per session on Opus 5.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-09-03.