create-hook

Create Cursor project or user hooks with hooks.json and scripts.

5|2|Updated Jan 10, 2017
One-click install
npx skills add https://github.com/brujack/dotfiles --skill create-hook-brujack
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-hook
Source: https://github.com/brujack/dotfiles/tree/main/.cursor/skills-cursor/create-hook
Command: npx skills add https://github.com/brujack/dotfiles --skill create-hook-brujack

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Cursor hooks let you run custom logic before or after agent events, enabling automation, auditing, and policy enforcement around Cursor workflows.

Core Features & Use Cases

  • Create project- or user-level hooks by adding scripts and a hooks.json to .cursor or ~/.cursor, letting Cursor run code before or after agent actions.
  • Support both command hooks and prompt hooks for flexible policies, including beforeShellExecution, beforeSubmitPrompt, and postToolUse.
  • Validate and troubleshoot hooks with a standardized hooks.json schema, guidance on matchers, and practical debugging steps to ensure hooks load reliably.

Quick Start

Create a project hook by placing a script under .cursor/hooks and registering it in .cursor/hooks.json.

Frequently Asked Questions about create-hook

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

FAQPage Schema
How do I automate Cursor hooks to run scripts before or after agent events?

Cursor hooks automate agent events by registering scripts in a hooks.json file, allowing you to run custom logic before or after actions. This supports both project and user-level configurations for workflow automation.

What is the difference between project hooks and user hooks in Cursor?

Project hooks are stored in the .cursor directory for project-specific automation, while user hooks are stored in ~/.cursor for global policies. Both use a hooks.json schema to govern agent events across environments.

Does Cursor support prompt hooks and command hooks for agent event control?

Yes, Cursor supports both command hooks and prompt hooks for flexible policy enforcement. Supported event types include beforeShellExecution, beforeSubmitPrompt, and postToolUse to manage agent workflows.

How do I troubleshoot Cursor hooks that are not loading or executing?

Troubleshoot Cursor hooks by validating your hooks.json against the standardized schema and checking matchers. Practical debugging steps ensure scripts are placed correctly in .cursor/hooks and load reliably.

Can I enforce security and auditing policies around Cursor workflows?

Yes, you can enforce security and auditing policies by creating event-driven hooks. By running custom validation scripts before agent actions like shell execution or prompt submission, you control workflow governance safely.

What is the best way to structure scripts and hooks.json for Cursor automation?

The best way to structure Cursor automation is to place scripts under .cursor/hooks and register them in .cursor/hooks.json. This schema-driven layout enforces a safe workflow with explicit guidance on hook types and locations.