create-hook

Define Cursor hook scripts with event triggers and JSON formatting.

Updated Mar 4, 2026
One-click install
npx skills add https://github.com/shankur/dots --skill create-hook-shankur
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-hook
Source: https://github.com/shankur/dots/tree/main/dot_cursor/skills-cursor/create-hook
Command: npx skills add https://github.com/shankur/dots --skill create-hook-shankur

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

The Skill unit "create-hook" provides a framework to efficiently manage Cursor hooks by defining and automating custom logic around agent events.

Core Features & Use Cases

  • Hook Creation: Simplifies the creation of Cursor hooks by guiding users through defining scope, trigger, behavior, and implementation.
  • Project and User Hooks: Offers instructions on where to place project and user-specific hooks.
  • Event Matching: Provides a list of common agent events to trigger hooks, including session, tool use, file edit, and shell command events.
  • Hook Formatting: Describes the JSON format for hooks.json files and examples of command and prompt hooks.

Quick Start

Create a new project hook by navigating to .cursor/hooks/ and creating a new shell script under my-hook.sh.

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 to run custom logic on agent events?

To create a hook in Cursor, you define event triggers, behaviors, and implementation details in a JSON formatted file. You can place project hooks in the .cursor/hooks/ directory as shell scripts to automate custom logic around agent events.

What is the correct JSON format for defining Cursor hooks?

The Cursor hooks format requires a JSON structure in a hooks.json file that specifies command and prompt hooks. This format defines the scope, trigger events, and behavior for executing custom shell scripts or prompt checks during agent sessions.

What agent events can I use as triggers for Cursor hooks?

Cursor hooks can be triggered by common agent events including session starts, tool usage, file edits, and shell command executions. Matching these events allows you to automate custom logic precisely when specific agent actions occur.

Where should I place project hooks versus user hooks in Cursor?

Project hooks are placed in the .cursor/hooks/ directory using shell scripts, while user-specific hooks are managed separately. This separation ensures project-level custom logic is version controlled, whereas user preferences remain isolated.

Can I use shell scripts for hook implementation in Cursor?

Yes, shell scripts are used for hook implementation in Cursor. You can create a new project hook by navigating to .cursor/hooks/ and writing a custom shell script, such as my-hook.sh, to define the hook behavior.

Does Cursor support prompt checks alongside command hooks?

Cursor supports both command hooks and prompt checks within its hook management framework. The hooks.json file allows you to define JSON formatting for executing shell scripts as well as validating agent prompts based on specific event triggers.