Writing Hookify Rules

Create and configure custom Hookify rules using YAML frontmatter and regex.

Updated Jan 5, 2026
One-click install
npx skills add https://github.com/sudat/req-manager --skill writing-hookify-rules-sudat
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Writing Hookify Rules
Source: https://github.com/sudat/req-manager/tree/main/.cursor/skills/writing-rules
Command: npx skills add https://github.com/sudat/req-manager --skill writing-hookify-rules-sudat

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a comprehensive guide to creating and managing custom rules for the Hookify system, enabling users to define specific behaviors and constraints for AI interactions.

Core Features & Use Cases

  • Rule Definition: Learn the YAML frontmatter structure, including name, enabled, event, pattern, and conditions.
  • Event Types: Understand how to apply rules to bash, file, stop, and prompt events.
  • Pattern Matching: Master regex basics and advanced condition operators for precise rule triggering.
  • Use Case: Define a rule to automatically block any bash command that attempts to delete files recursively (rm -rf), ensuring data safety.

Quick Start

Create a new hookify rule by defining its name, event type, and pattern in a .local.md file within the .claude/ directory.

Frequently Asked Questions about Writing Hookify Rules

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

FAQPage Schema
How do I create custom rules to modify AI agent behavior?

You create custom AI behavior rules by defining YAML frontmatter in a `.local.md` file within the `.claude/` directory, specifying the rule name, enabled status, event type, pattern, and conditions for deterministic execution.

What events can I target with Hookify rules for AI interactions?

Hookify rules can target `bash`, `file`, `stop`, and `prompt` events. This allows you to intercept and modify AI agent behavior at specific execution points for safety enforcement and task control.

Can I use regex to match specific bash commands and block dangerous operations?

Yes, you can use regex pattern matching to trigger rules on specific commands. For example, you can define a rule to automatically block any bash command attempting to recursively delete files (`rm -rf`) to ensure data safety.

How does conditional logic work when configuring AI behavior rules?

Conditional logic in AI behavior rules uses advanced condition operators within YAML frontmatter. This enables nuanced rule application, allowing you to enforce constraints only when defined regex patterns and event conditions are met.

Do I need any external dependencies to start writing Hookify rules?

No external dependencies are required. You only need to create a `.local.md` file in the `.claude/` directory and use YAML frontmatter syntax to begin defining rules for your AI agent behavior modification.

Why are my regex patterns not triggering rules on bash events?

Regex patterns may fail if the `enabled` field is false in the YAML frontmatter, or if the `event` type is not set to `bash`. Ensure your pattern syntax aligns with the command structure for precise rule triggering.