Writing Hookify Rules

Create and manage custom AI behavior rules with YAML and regex.

Updated Feb 24, 2026
One-click install
npx skills add https://github.com/AWS-Educate/template-nextjs-sanity-tailwind-amplify --skill writing-hookify-rules-aws-educate
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Writing Hookify Rules
Source: https://github.com/AWS-Educate/template-nextjs-sanity-tailwind-amplify/tree/main/.agents/skills/writing-hookify-rules
Command: npx skills add https://github.com/AWS-Educate/template-nextjs-sanity-tailwind-amplify --skill writing-hookify-rules-aws-educate

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps users define custom rules that guide the AI's behavior, ensuring it adheres to specific patterns, avoids certain actions, or follows predefined workflows.

Core Features & Use Cases

  • Rule Creation: Define rules with names, events, and patterns.
  • Conditional Logic: Implement complex rules using multiple conditions.
  • Action Control: Specify actions like 'warn' or 'block' for triggered rules.
  • Use Case: You can create a rule to automatically warn the AI whenever it attempts to use a dangerous bash command like rm -rf, or to block edits to sensitive files like .env.

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 define custom AI behavior rules to block dangerous bash commands?

To define custom AI behavior rules, create a configuration in a `.local.md` file specifying the event type, regex patterns for matching commands like `rm -rf`, and a 'block' or 'warn' action to enforce restrictions.

Can I use regex and YAML to configure AI tool usage restrictions?

Yes, you can use regex and YAML to configure AI tool usage restrictions by defining rule names, event types like bash or file edits, and pattern matching conditions to trigger warning or blocking actions.

What are AI behavior rules and when do I need them for workflow control?

AI behavior rules are custom configurations that guide AI actions by enforcing specific patterns and avoiding certain actions. You need them to prevent edits to sensitive files like `.env` or restrict dangerous commands.

How to create custom rules that warn the AI when editing sensitive files?

Create custom warning rules by defining a 'file' event type in a `.local.md` file, using regex to match sensitive file paths like `.env`, and setting the action to 'warn' to alert the AI before proceeding.

Do I need to know regex to set up complex conditional rules for AI responses?

Yes, understanding regex is required to set up complex conditional rules for AI responses, as it enables precise pattern matching for event types like bash, file, stop, and prompt triggers within your YAML configuration.

What events are supported by hookify rules for controlling AI tool usage?

Hookify rules support controlling AI tool usage through event types including bash, file, stop, and prompt, allowing you to implement complex conditions that trigger warn or block actions based on specific patterns.