Writing Hookify Rules

Installation
Summary

Define patterns and messages that trigger Claude warnings or blocks on specific agent actions.

  • Supports four event types (bash commands, file edits, agent stop, user prompts) plus an "all" catch-all, each with regex or multi-condition matching
  • Rules use markdown files with YAML frontmatter stored in .claude/hookify.{name}.local.md; changes take effect immediately on next tool use
  • Two matching modes: simple pattern field for single-condition rules, or advanced conditions array for multi-field logic with operators like regex_match, contains, equals, and starts_with
  • Actions default to warn (show message, allow operation) or can be set to block (prevent operation or stop session)
  • Includes regex pattern guide with common metacharacters, escaping rules, and examples for detecting dangerous commands, debug code, security risks, and sensitive files
SKILL.md

Writing Hookify Rules

Overview

Hookify rules are markdown files with YAML frontmatter that define patterns to watch for and messages to show when those patterns match. Rules are stored in .claude/hookify.{rule-name}.local.md files.

Rule File Format

Basic Structure

---
name: rule-identifier
enabled: true
event: bash|file|stop|prompt|all
pattern: regex-pattern-here
---

Message to show Claude when this rule triggers.
Related skills

More from anthropics/claude-code

Installs
GitHub Stars
122.7K
First Seen