hooks-builder

Configure Cursor agent hooks via hooks.json to observe, block, or modify actions.

8|Updated Feb 8, 2026
One-click install
npx skills add https://github.com/kensaurus/cursor-kenji --skill hooks-builder-kensaurus
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: hooks-builder
Source: https://github.com/kensaurus/cursor-kenji/tree/main/skills/hooks-builder
Command: npx skills add https://github.com/kensaurus/cursor-kenji --skill hooks-builder-kensaurus

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Hooks provide a structured way to automate, observe, and control the Cursor agent loop, reducing manual interventions and enabling governance over behavior.

Core Features & Use Cases

  • Define events such as sessionStart, preToolUse, beforeShellExecution, beforeMCPExecution, and more to observe, block, or modify agent actions.
  • Configure global or project-scoped rules via hooks.json to automate actions like auto-formatting, security gates, audit logging, and PII scanning.
  • Practical use cases include validating tool usage before execution, guarding terminal commands, and auditing agent activity for compliance.

Quick Start

Create a hooks.json at the project root and add a simple hook script to begin automating and observing the agent loop.

Frequently Asked Questions about hooks-builder

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

FAQPage Schema
How do I automate and control the Cursor agent loop with hooks?▼

You can automate and control the Cursor agent loop by defining a hooks.json file at the project or global scope, using event triggers like sessionStart or preToolUse to observe, block, or modify agent actions.

What events can I hook into to observe or block Cursor agent actions?▼

Available hook events include sessionStart, preToolUse, beforeShellExecution, and beforeMCPExecution, allowing you to observe, block, or modify agent actions during development workflows.

How do I set up security gates and audit logging for Cursor agent tool usage?▼

Set up security gates and audit logging by configuring rules in a hooks.json file and adding optional scripts in a scripts/ directory to validate tool usage or audit agent activity before execution.

Can I apply Cursor hooks globally or do I need project-scoped configurations?▼

Cursor hooks can be applied at both global and project scopes, requiring a hooks.json configuration file to define deterministic rules for automating actions like PII scanning and command guarding.

How do I validate terminal commands before the Cursor agent executes them?▼

Validate terminal commands by configuring the beforeShellExecution event in your hooks.json, which guards terminal commands and blocks unauthorized shell executions before they run.