Agent skill · writing content · anthropics

Writing Hookify Rules

This skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.

Why this skill is useful

Provides specific syntax and patterns for creating Hookify rules that the AI wouldn't reliably generate on its own.

What it needs

About 5k tokens when loaded. Last updated 2026-08-06. 140,522 stars on the source repository.

What this skill does

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 Frontmatter Fields name (required): Unique identifier for the rule Use kebab-case: warn-dangerous-rm, block-console-log Be descriptive and action-oriented Start with verb: warn, prevent, block, require, check enabled (required): Boolean to activate/deactivate true: Rule is active false: Rule is disabled (won't trigger) Can toggle without deleting rule event (required): Which hook event to trigger on bash: Bash tool commands file: Edit, Write, MultiEdit tools stop: When agent wants to stop prompt: When user submits a prompt all: All events action (optional): What to do when rule matches warn: Show message but allow operation (default) block: Prevent operation (PreToolUse) or stop session (Stop events) If omitted, defaults to warn pattern (simple format): Regex pattern to match Used for simple single-condition rules Matches against command (bash) or newtext (file) Python regex syntax Example: Advanced Format (Multiple Conditions) For complex rules with multiple conditions: Condition fields: field: Which field to check For bash: command For file: filepath, newtext, oldtext, content operator: How to match regexmatch: Regex pattern matching contains: Substring check equals: Exact match notcontains: Substring must NOT be present startswith: Prefix check endswith: Suffix check pattern: Pattern or string to match All conditions must match for rule to trigger. Message Body The markdown content after frontmatter is shown to Claude when the rule triggers. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills anthropics/writing-rules--fa9d6e

View the source on GitHub

Browse the @skills marketplace