create-hook

Create Cursor IDE hooks that run scripts or prompts around agent events.

3|Updated Jul 2, 2026
One-click install
npx skills add https://github.com/ArangoGutierrez/claude-toolkit --skill create-hook-arangogutierrez
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: create-hook
Source: https://github.com/ArangoGutierrez/claude-toolkit/tree/main/.cursor/skills-cursor/create-hook
Command: npx skills add https://github.com/ArangoGutierrez/claude-toolkit --skill create-hook-arangogutierrez

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Automating behavior around Cursor agent events requires knowing the hooks.json schema, event names, matchers, and JSON stdin/stdout protocol, which is easy to get wrong. This Skill guides the creation of working project or user hooks that observe, block, modify, or follow up on agent behavior. ## Core Features & Use Cases - Event Selection Guidance: Maps goals to the narrowest correct hook event such as beforeShellExecution, preToolUse, afterFileEdit, or subagentStop. - Command and Prompt Hooks: Generates executable shell scripts that exchange JSON over stdin/stdout, or prompt-based hooks for policy decisions. - Matchers and Safety: Configures JavaScript-regex matchers, failClosed behavior, timeouts, and loop limits, with validation and troubleshooting steps. - Use Case: You want Cursor to ask for approval before any shell command that makes a network request. The Skill creates a beforeShellExecution hook with a curl|wget matcher that returns an "ask" permission response. ## Quick Start Create a Cursor project hook that blocks shell commands containing rm -rf and asks for confirmation before running them.

Frequently Asked Questions about create-hook

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a hook in Cursor IDE?▼

Create a hooks.json file with schema version 1 in .cursor/ for project hooks or ~/.cursor/ for user hooks, then add hook entries under the desired event. Command hooks run executable scripts that read JSON from stdin and return JSON on stdout.

How do I block or approve shell commands in Cursor?▼

Use the beforeShellExecution event with a command hook that inspects the command string from stdin JSON. Return a permission field of allow, ask, or deny, or exit with code 2 to block the action.

What is the difference between command hooks and prompt hooks in Cursor?▼

Command hooks run executable scripts for deterministic, auditable logic, while prompt hooks send the hook input to a model for policy decisions described in natural language. Use prompt hooks for lightweight checks and command hooks when exact behavior matters.

Why is my Cursor hook not loading or firing?▼

Hooks commonly fail due to matcher regex errors, wrong relative paths, or non-executable scripts. Remove the matcher to confirm the base hook works, verify paths relative to the project root or ~/.cursor/, and check the Hooks settings tab or output channel.

When should I use failClosed on a Cursor hook?▼

Set failClosed to true when a hook crash, timeout, or invalid JSON output should block the action rather than allow it. This is appropriate for security gates like network command approval, but not for advisory hooks where failures should fail open.