Writing Hookify Rules

Write Hookify rules with YAML frontmatter and regex conditions for agent events.

Updated Mar 27, 2026
One-click install
npx skills add https://github.com/quanngynx/GDGO-2026.Servexa-Warranty-AI --skill writing-hookify-rules-quanngynx
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Writing Hookify Rules
Source: https://github.com/quanngynx/GDGO-2026.Servexa-Warranty-AI/tree/main/servexa-warranty-ai/.cursor/skills/writing-rules
Command: npx skills add https://github.com/quanngynx/GDGO-2026.Servexa-Warranty-AI --skill writing-hookify-rules-quanngynx

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing Hookify rules that correctly trigger on the right events and patterns, while producing clear guidance messages for Claude.

Core Features & Use Cases

  • Hookify rule authoring: Define rule YAML frontmatter with required fields like enabled, event, name, and pattern.
  • Advanced conditional matching: Use multi-condition rules to target edits or commands using fields such as file_path, new_text, command, and more.
  • Operational guidance: Provide best practices for regex specificity, escaping issues in YAML, and where rule files should be stored so they load dynamically.

Quick Start

Ask the AI to create a Hookify rule that blocks edits containing "API_KEY" in any file ending with .env.

Frequently Asked Questions about Writing Hookify Rules

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

FAQPage Schema
How do I write agent guardrails to block unsafe file edits?

Agent guardrails for file edits are written as Hookify rules using YAML frontmatter with event, pattern, and conditions fields to deterministically trigger warnings or blocks on specific bash, file-edit, or stop events.

What is a Hookify rule and how does it control agent behavior?

A Hookify rule is a YAML configuration file with frontmatter that attaches deterministic trigger patterns and guidance messages to Claude, preventing unwanted agent actions during bash, file-edit, stop, and prompt events.

How do I use regex to match file paths and edited content in Hookify rules?

Regex matching in Hookify rules uses multi-condition fields targeting file_path, new_text, and command attributes, allowing you to specify precise pattern triggers for edited content and file paths within a single rule definition.

What YAML frontmatter fields are required for a Hookify rule?

Hookify rule YAML frontmatter requires name, description, enabled, and event fields, plus correctly structured pattern or conditions blocks, so the rule loads dynamically from the expected local filename convention.

Can I create multi-condition rules to target specific bash commands and file edits?

Yes, multi-condition Hookify rules target specific bash commands and file edits by combining fields such as command, file_path, and new_text to match complex agent behaviors and provide tailored Claude guidance messages.

Why are my Hookify rules not triggering on file edit events?

Hookify rules fail to trigger when YAML frontmatter is malformed, regex patterns lack specificity, or the rule file is not stored in the expected local directory, preventing dynamic loading during file-edit events.