writing-hookify-rules

Originally fromanthropics/claude-code
Installation
Summary

Define patterns and messages that trigger contextual warnings or blocks during agent tool use.

  • Rules are markdown files with YAML frontmatter stored in .claude/hookify.{rule-name}.local.md that match against bash commands, file edits, agent stops, or user prompts
  • Supports simple regex patterns or advanced multi-condition rules with operators like regex_match, contains, equals, and starts_with
  • Actions include warn (show message, allow operation) or block (prevent operation or stop session)
  • Common use cases: prevent dangerous commands (rm -rf, sudo), catch debug code (console.log), protect sensitive files (.env, .pem), and enforce completion checklists before stopping
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-plugins-official

Installs
2.4K
GitHub Stars
19.2K
First Seen
Feb 5, 2026