create-hook

Define deterministic event-driven hooks for Cursor agent behavior.

1|Updated Apr 16, 2026
One-click install
npx skills add https://github.com/PandelisZ/skills --skill create-hook-pandelisz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-hook
Source: https://github.com/PandelisZ/skills/tree/main/skills/create-hook
Command: npx skills add https://github.com/PandelisZ/skills --skill create-hook-pandelisz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Create hooks when you want the agent to run custom logic before or after agent events. Hooks are scripts or prompt-based checks that exchange JSON over stdin/stdout and can observe, block, modify, or follow up on behavior.

Core Features & Use Cases

  • Define project-level hooks to govern agent behavior across sessions.
  • Configure events such as preToolUse, postToolUse, beforeShellExecution, and afterAgentResponse to gate, audit, or augment actions.
  • Use provided hooks.json and scripts to implement deterministic logic and safety checks.

Quick Start

Write a simple project hook by placing a hooks.json at .cursor/hooks.json and adding a beforeShellExecution script to enforce a policy.

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 agent hooks to run custom scripts before tool use?

Automate Cursor agent hooks by defining a hooks.json configuration at .cursor/hooks.json and adding event-driven scripts that exchange JSON over stdin/stdout to observe, block, or modify actions. This lets you run custom logic before or after agent events.

Can I enforce a safety policy before shell execution using Cursor hooks?

Yes, you can enforce safety policies before shell execution by configuring a beforeShellExecution hook in your hooks.json. The hook script receives JSON input via stdin and can block or allow the action based on your deterministic logic.

What events are available for Cursor agent hooks to audit or guard actions?

Available events for Cursor agent hooks include preToolUse, postToolUse, beforeShellExecution, and afterAgentResponse. These events allow you to gate, audit, guard, or augment agent actions across project or user-level sessions.

How do I structure a hooks.json file to extend Cursor agent behavior?

Structure your hooks.json by defining deterministic, event-driven hooks that map to supported events like preToolUse or afterAgentResponse. You can place optional hook scripts in a scripts/ directory and reference them to implement validation and testing workflows.

Do I need to write JSON scripts to configure hooks for the Cursor agent?

Yes, hooks are scripts or prompt-based checks that exchange JSON over stdin/stdout to communicate with the agent. Writing these scripts allows you to observe, block, modify, or follow up on agent behavior deterministically.

What is the best way to validate and test Cursor agent hooks before applying them to a project?

The best way to validate hooks is to follow a structured process of building, validating, and testing them using the provided hooks.json configuration workflow and optional scripts. This ensures your deterministic logic and safety checks function correctly before applying them.