create-hook

Create and manage Cursor hooks for automating pre/post agent event logic.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/cuongnm-dev/team-ai-config --skill create-hook-cuongnm-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-hook
Source: https://github.com/cuongnm-dev/team-ai-config/tree/main/cursor/skills-cursor/create-hook
Command: npx skills add https://github.com/cuongnm-dev/team-ai-config --skill create-hook-cuongnm-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Create and manage Cursor hooks to run custom logic before or after agent events.

Core Features & Use Cases

  • Define project hooks using .cursor/hooks and hooks.json to enforce policies, audit steps, or modify agent prompts.
  • Implement script-based and prompt-based hooks for flexible control over tool usage and responses.
  • Use cases include preToolUse filtering, beforeShellExecution gating, and afterFileEdit post-processing to enhance workflows.

Quick Start

Place a shell script in .cursor/hooks and reference it in .cursor/hooks.json to enable a project hook.

Frequently Asked Questions about create-hook

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

FAQPage Schema
How do I create Cursor hooks for event-driven automation?

You create Cursor hooks by defining script or prompt hooks in project-level or user-level hooks.json files to run custom logic before or after agent events.

What events can I target with Cursor hooks?

Cursor hooks support events such as preToolUse, beforeShellExecution, and afterFileEdit, enabling you to filter tool usage, gate shell commands, or post-process file modifications.

Can I use both scripts and prompts for Cursor hooks?

Yes, Cursor hooks support both script-based and prompt-based implementations to enforce policies, audit steps, or modify agent prompts based on the documented hooks.json format.

What is the difference between project hooks and user hooks?

Project hooks are defined using the .cursor/hooks directory and project-level hooks.json, while user hooks operate at the user level to manage custom logic for agent events.

How do I ensure my hooks.json schema is valid?

The Skill enforces the Cursor hooks schema and provides guidance for safe implementation, ensuring your script or prompt hooks are correctly formatted within the documented hooks.json structure.

When should I use beforeShellExecution hooks?

Use beforeShellExecution hooks to gate shell command executions, allowing you to enforce policies or audit steps before an agent runs custom logic during an event.