Writing Hookify Rules

Create hookify rule files with YAML frontmatter and regex patterns for hook events.

Updated Mar 22, 2026
One-click install
npx skills add https://github.com/ace8991/agentos --skill writing-hookify-rules-ace8991
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Writing Hookify Rules
Source: https://github.com/ace8991/agentos/tree/main/.tmp_claude_code/claude-code-main/plugins/hookify/skills/writing-rules
Command: npx skills add https://github.com/ace8991/agentos --skill writing-hookify-rules-ace8991

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing hookify rules requires knowing the exact frontmatter schema, event types, condition operators, and regex conventions, and mistakes in any of these silently break rule enforcement. ## Core Features & Use Cases - Rule Authoring Guidance: Explains the required frontmatter fields (name, enabled, event, pattern, action) and the markdown message body format for .claude/hookify.{name}.local.md files. - Event and Condition Reference: Covers bash, file, stop, prompt, and all events, plus multi-condition rules using operators like regex_match, contains, and starts_with. - Use Case: You want to block dangerous rm -rf commands or warn when console.log is added to TypeScript files; this Skill walks you through writing, naming, testing, and toggling the rule file. ## Quick Start Ask the assistant to create a hookify rule that warns whenever a bash command matches a dangerous pattern like rm -rf.

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 a hookify rule for Claude Code?

Create a markdown file named .claude/hookify.{rule-name}.local.md with YAML frontmatter containing name, enabled, event, and pattern fields, followed by the warning message body. Rules are read dynamically, so they take effect on the next tool use.

What event types can a hookify rule trigger on?

Hookify rules support bash, file, stop, prompt, and all event types. Bash matches commands, file matches Edit/Write/MultiEdit operations, stop fires on completion, and prompt matches user input.

Can a hookify rule block an operation instead of just warning?

Yes, set the optional action field to block in the frontmatter. This prevents the operation on PreToolUse events or stops the session on Stop events; omitting it defaults to warn.

How do I match multiple conditions in one hookify rule?

Use the advanced conditions format with a list of field, operator, and pattern entries instead of a single pattern. All conditions must match for the rule to trigger, with operators like regex_match, contains, equals, and starts_with.

Why is my hookify regex pattern not matching?

Common causes are unescaped special characters like dots and parentheses, or patterns that are too broad or too specific. Test patterns with python3 -c "import re; print(re.search(...))" and prefer unquoted YAML patterns to avoid double-backslash issues.

How do I temporarily disable a hookify rule?

Set enabled to false in the rule's frontmatter to deactivate it without deleting the file. To remove it permanently, delete the .local.md file from the .claude directory.