create-hook

create-hook is a skill for Claude Code from Kevin-Liu-01/Agent-Machines. It costs 31 tokens per session (2,178 once invoked), scanned A, original, MIT.

A guide for creating Cursor hooks: scripts or checks that run before or after an AI agent event. They can inspect, stop, change, or continue the agent's actions.

In plain words
What is it for?
Use it to create or update `.cursor/hooks.json` and hook scripts. It helps automate checks, block actions, rewrite inputs, add context, or continue workflows around agent events.
Why use it?
It removes the need to work out hook files, event triggers, filters, and failure behavior from scratch. It also helps place hooks correctly for one project or for your whole user account.

Skill for Claude Code

Written for Claude Code: $ARGUMENTS substitution. Also seen: mentions subagents.

Good fit Use it to create or update .cursor/hooks.json and hook scripts. It helps automate checks, block actions, rewrite inputs, add context, or continue workflows around agent events.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kevin-liu-01/agent-machines/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 Kevin-Liu-01/Agent-Machines --skill create-hook
Clone the repo
git clone --depth 1 https://github.com/Kevin-Liu-01/Agent-Machines

Made for: Claude Code.

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/kevin-liu-01/agent-machines/create-hook/github.svg)](https://agentmods.dev/skills/kevin-liu-01/agent-machines/create-hook)
Your own site
<a href="https://agentmods.dev/skills/kevin-liu-01/agent-machines/create-hook"><img src="https://agentmods.dev/badge/skills/kevin-liu-01/agent-machines/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/kevin-liu-01/agent-machines/create-hook"><img src="https://agentmods.dev/badge/skills/kevin-liu-01/agent-machines/create-hook.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 31 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,178 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. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 2 findings, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Rogue Agent · line 4
    Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
    Fix: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.
  • medium Rogue Agent · line 203
    Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
    Fix: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.
How audits are shown
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.00031 $0.02178
Opus 5 $0.00015 $0.01089
Sonnet 5 $0.00006 $0.00436
Haiku 4.5 $0.00003 $0.00218

Measured 9d ago against content hash 28bfa0c6cd13, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, 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 9d 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

Copies of this mod

3 near-identical copies found in the catalogue:

knowledge/skills/create-hook/SKILL.md · 240 lines

How it starts

The opening of the file, as written. The whole thing — 240 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 · 240 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. 9d ago First seen · 240 lines · 31 tokens per session scan A 28bfa0c6cd13

Subscribe to this mod's changes

create-hook is a skill published in the GitHub repository Kevin-Liu-01/Agent-Machines (26 stars, last pushed 8d ago), licensed MIT. It adds 31 tokens to every session and 2,178 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

agent-reach

An internet-search and platform-access router for finding information across websites and services such as Reddit, X, GitHub, YouTube, and job sites.

Panniantong/Agent-Reach · 349 tokens

xiaohongshu-search-full

Search Xiaohongshu (XHS / RedNote) notes by keyword with full field extraction including body text, topics/tags, image list URLs, video stream URL, publish timestamp, and all engagement stats (likes, collects, comments, shares). Supports all page filter options: sort order (general, latest, most liked, most commented…

browser-act/skills · 254 tokens

using-ao

Catalog of the AO (Agent Orchestrator) ao CLI: spawning workers, managing sessions and projects, sending messages, controlling the shared browser, previewing pages, and daemon control. Use when using the ao CLI, spawning workers, or managing AO sessions in an AO workspace.

Untrivial-ai/agent-orchestrator · 62 tokens

1688-product-detail

Extracts comprehensive wholesale product data from 1688.com product detail pages: title, tiered pricing, SKU variants with dimensions/weight, product images, seller info, shop scores, buyer protection, cross-border flags, product attributes, coupon/promotion data, and review stats. Use when user mentions 1688…

browser-act/skills · 212 tokens

youtube-channel-business-email

YouTube channel business email and contact extractor: accepts a channel id (UCxxx), handle (@name), or URL; navigates the channel About view; extracts the business email from the description text plus full channel metadata (name, id, country, subscriber count, view count, video count, joined date, external links…

browser-act/skills · 324 tokens

google-maps-contact-extract

Extracts business contact details from Google Maps search results and place detail pages, then visits each business website to collect emails, phone numbers, and social media profiles (Facebook, Instagram, Twitter/X, LinkedIn, YouTube, TikTok, Pinterest, Discord). Use when user mentions Google Maps contact extraction…

browser-act/skills · 152 tokens