create-hook

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

Updated Apr 15, 2026
One-click install
npx skills add https://github.com/shoshoavi/agentic_worflows --skill create-hook-shoshoavi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: create-hook
Source: https://github.com/shoshoavi/agentic_worflows/tree/main/cursor/skills-cursor/create-hook
Command: npx skills add https://github.com/shoshoavi/agentic_worflows --skill create-hook-shoshoavi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Automating behavior around Cursor agent events requires knowing the correct hook event, file location, JSON schema, and output fields, and mistakes in any of these cause hooks to silently fail or block the wrong actions. ## Core Features & Use Cases - Event Selection Guidance: Maps user goals to the narrowest correct hook event such as beforeShellExecution, afterFileEdit, preToolUse, or subagentStop. - Command and Prompt Hooks: Creates executable script hooks that exchange JSON over stdin/stdout, or prompt-based hooks for lightweight policy decisions. - Matcher and Safety Configuration: Configures JavaScript-regex matchers, failClosed behavior, timeouts, and loop limits for controlled execution. - Use Case: A team wants every curl or wget command reviewed before execution. The Skill creates a project-level .cursor/hooks.json with a beforeShellExecution hook script that returns an "ask" permission for network commands. ## Quick Start Create a project-level Cursor hook that asks for approval before any shell command containing curl or wget runs.

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 Cursor hook to block shell commands?▼

Create a hooks.json file with a beforeShellExecution entry pointing to a script that reads JSON from stdin and returns a permission field of allow, ask, or deny. Use a matcher like "curl|wget" to limit which commands trigger the hook.

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

Command hooks run executable scripts that exchange JSON over stdin/stdout and provide deterministic, auditable behavior. Prompt hooks send the hook input to a model for policy decisions and suit cases where the rule is easier to describe than to script.

Should I use project hooks or user hooks in Cursor?▼

Project hooks live in .cursor/hooks.json relative to the project root and can be checked into version control for team sharing. User hooks live in ~/.cursor/hooks.json and apply across all projects for personal automation.

Why is my Cursor hook not loading or firing?▼

Hooks commonly fail due to matcher regex errors, wrong relative paths, or missing executable permissions on the script. Remove the matcher first to confirm the base hook fires, then verify paths and check the Hooks settings tab or output channel.

What does failClosed do in a Cursor hook configuration?▼

failClosed blocks the action when the hook crashes, times out, or returns invalid JSON. Without it, hook failures default to fail-open behavior, allowing the action to proceed despite the error.