create-hook

create-hook is a skill for Claude Code from kensaurus/cursor-kenji. It costs 28 tokens per session (2,203 once invoked), scanned A, a copy of create-hook, MIT.

A guide for creating Cursor hooks, which are scripts or checks that run around coding-agent events.

In plain words
What is it for?
Use it to create or update hook configuration and scripts that audit, block, rewrite, add context, or continue agent actions.
Why use it?
It helps turn vague automation requests into correctly scoped hooks with clear triggers, filtering, and failure behavior.

Skill for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter. Also seen: mentions subagents.

Part of the cursor-kenji plugin — 132 skills, 63 commands, 6 agents, 1 hook, 3 MCP servers shipped together

Good fit Use it to create or update hook configuration and scripts that audit, block, rewrite, add context, or continue agent actions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kensaurus/cursor-kenji/create-hook
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 kensaurus/cursor-kenji --skill create-hook
Clone the repo
git clone --depth 1 https://github.com/kensaurus/cursor-kenji

Made for: Claude Code.

Or install cursor-kenji, the plugin that ships this one along with the rest of its 132 skills, 63 commands, 6 agents, 1 hook, 3 MCP servers.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/kensaurus/cursor-kenji/create-hook"><img src="https://agentmods.dev/badge/skills/kensaurus/cursor-kenji/create-hook.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 28 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,203 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin 94% copy Near-identical to another mod 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.00028 $0.02203
Opus 5.5 $0.00011 $0.00881
Sonnet 5.5 $0.00006 $0.00441
Haiku 4.5 $0.00003 $0.00220

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

Security

Grade A, and why

create-hook scanned grade A 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 2mo 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

"matcher": "curl|wget|nc ",
Origin

This is a copy

94% identical to create-hook — 7 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills-cursor/create-hook/SKILL.md · 239 lines

How it starts

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

Creating Cursor Hooks

Create hooks when you want Cursor to run custom logic before or after agent events. Hooks are scripts or prompt-based checks that exchange JSON over stdin/stdout and can observe, block, modify, or follow up on behavior.

When the user asks for a hook, don't stop at describing the format. Gather the missing requirements, then create or update the hook files directly.

Gather Requirements

Before you write anything, determine:

  1. Scope: Should this be a project hook or a user hook?
  2. Trigger: Which event should run the hook?
  3. Behavior: Should it audit, deny/allow, rewrite input, inject context, or continue a workflow?
  4. Implementation: Should it be a command hook (script) or a prompt hook?
  5. Filtering: Does it need a matcher so it only runs for certain tools, commands, or subagent types?
  6. Safety: Should failures fail open or fail closed?

Infer these from the conversation when possible. Only ask for the missing pieces.

Choose the Right Location

  • Project hooks: .cursor/hooks.json and .cursor/hooks/*
  • User hooks: ~/.cursor/hooks.json and ~/.cursor/hooks/*

Path behavior matters:

  • Project hooks run from the project root, so use paths like .cursor/hooks/my-hook.sh
  • User hooks run from ~/.cursor/, so use paths like ./hooks/my-hook.sh or hooks/my-hook.sh

Prefer project hooks when the behavior should be shared with the repository and checked into version control.

Choose the Hook Event

Use the narrowest event that matches the user's goal.

Common Agent events

  • sessionStart, sessionEnd: set up or audit a session
  • preToolUse, postToolUse, postToolUseFailure: work across all tools
  • subagentStart, subagentStop: control or continue Task/subagent workflows
  • beforeShellExecution, afterShellExecution: gate or audit terminal commands
  • beforeMCPExecution, afterMCPExecution: gate or audit MCP tool calls
  • beforeReadFile, afterFileEdit: control file reads or post-process edits
  • beforeSubmitPrompt: validate prompts before they are sent
  • preCompact: observe context compaction
  • stop: handle agent completion
  • afterAgentResponse, afterAgentThought: track agent output or reasoning

Read the full file on GitHub · 239 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. 2mo ago Changed 7c5c8339c177
  2. 2mo ago First seen · 239 lines · 28 tokens per session scan A be87104bbf49

Subscribe to this mod's changes

create-hook is a skill published in the GitHub repository kensaurus/cursor-kenji (9 stars, last pushed 2mo ago), licensed MIT. It adds 28 tokens to every session and 2,203 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). It is 94% identical to create-hook, differing in 7 lines, and is treated as a copy.

Related

create-hook compared with skills from other repositories

create-hook next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
create-hookkensaurus/cursor-kenjiSkill92mo agoMITA28Claude Code
code-review-codexjaansokk/cursor_toolsSkill111d agoMITA45Claude Code
summarizerjaansokk/cursor_toolsSkill111d agoMITA152Claude Code
yt-transcriptjaansokk/cursor_toolsSkill111d agoMITA104Claude Code
codex-reviewjaansokk/cursor_toolsSkill111d agoMITA50Cursor
ui-designjaansokk/cursor_toolsSkill111d agoMITA50Codex
react-devjaansokk/cursor_toolsSkill111d agoMITA29Claude Code