Writing Hookify Rules

Create Hookify rule definitions with YAML frontmatter and markdown bodies.

33.3k|3.8k|Updated Nov 20, 2025
One-click install
npx skills add https://github.com/anthropics/claude-plugins-official --skill writing-hookify-rules
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Writing Hookify Rules
Source: https://github.com/anthropics/claude-plugins-official/tree/main/plugins/hookify/skills/writing-rules
Command: npx skills add https://github.com/anthropics/claude-plugins-official --skill writing-hookify-rules

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you define custom rules to automate Claude's responses and actions, preventing unwanted behaviors or enforcing best practices. It solves the problem of needing to manually guide Claude in repetitive scenarios or when specific guardrails are required.

Core Features & Use Cases

  • Event-Driven Automation: Trigger rules on bash, file, stop, prompt, or all events.
  • Pattern Matching: Define rules using simple regex or advanced multi-condition logic.
  • Actionable Feedback: Configure rules to warn Claude or block operations, providing tailored messages.
  • Use Case: Prevent accidental rm -rf commands by creating a bash event rule that blocks such commands and warns Claude about dangerous operations.

Quick Start

Use the Writing Hookify Rules skill to create a rule that warns Claude when it tries to add 'console.log' to a JavaScript file.

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 rules to monitor and block dangerous bash commands?

Define a Hookify rule with event type `bash`, use regex patterns to match commands like `rm -rf`, and set the action to `block` with a warning message. The rule triggers when Claude attempts the matched command and prevents execution while displaying your custom alert.

Can I set up rules that trigger on file edits in Claude?

Yes, create a `file` event rule with pattern matching to detect specific file modifications. For example, match file paths and content patterns to warn Claude before adding debug statements like `console.log` to production files.

What's the difference between warn and block actions in Hookify rules?

Warn actions display an alert to Claude but allow the operation to proceed; block actions prevent the operation and show your message. Use warn for guidance and block for hard guardrails on risky or policy-violating actions.

How do I write multi-condition rules that match multiple patterns?

Hookify supports advanced rule formats with multi-condition logic in addition to simple regex patterns. Combine conditions using your rule definition to trigger only when multiple criteria match, enabling precise control over when rules apply.

Do Hookify rules work on user prompts and stop events?

Yes, Hookify supports `prompt`, `stop`, and `all` event types alongside `bash` and `file` events. This lets you enforce rules across the full interaction lifecycle, from user input through Claude's responses and operations.

What format do Hookify rules use and where do I define them?

Rules use YAML frontmatter for metadata fields like name, enabled, event, pattern, conditions, and action, followed by a markdown message body. This structured format makes rules both machine-readable and human-friendly for configuration.