writing-hookify-rules

Create Hookify rules with YAML frontmatter for bash and file event detection.

28|5|Updated Jun 24, 2025
One-click install
npx skills add https://github.com/thevibeworks/claude-code-docs --skill writing-hookify-rules-thevibeworks
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: writing-hookify-rules
Source: https://github.com/thevibeworks/claude-code-docs/tree/main/content/github/claude-plugins-official/plugins/hookify/skills/writing-rules
Command: npx skills add https://github.com/thevibeworks/claude-code-docs --skill writing-hookify-rules-thevibeworks

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps you create Hookify rules that reliably detect risky or unwanted actions (like bash commands or file edits) and show the right guidance or enforcement message when those patterns occur.

Core Features & Use Cases

  • Rule Authoring with YAML frontmatter: Define hook event type, enable/disable state, and matching patterns in a consistent Hookify rule format.
  • Pattern matching and guidance messages: Use regex patterns and optional multi-condition logic to trigger messages that explain why something is problematic and what to do instead.
  • Common safety scenarios: Create rules for dangerous bash commands, suspicious file edits (like editing secrets files), and completion checks that encourage the agent to verify required steps.

Quick Start

Ask your Claude Code session to “write a Hookify rule that blocks any bash command matching rm -rf and include a clear warning message explaining why it’s risky and what safer alternatives to use are.”

Frequently Asked Questions about writing-hookify-rules

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a Hookify rule to block dangerous bash commands?

To write a Hookify rule blocking dangerous bash commands, define YAML frontmatter with name, enabled, event, and pattern fields. Use regex in the pattern field to match commands like rm -rf, then add instructions specifying the warning message and safer alternatives to guide agent behavior.

What is YAML frontmatter syntax for Hookify rules?

YAML frontmatter for Hookify rules requires name, enabled, event, and pattern fields. You can also use conditions instead of pattern for multi-condition matching logic. These fields control when the rule triggers and what operational message displays to guide the agent.

Can I use multi-condition matching instead of regex in Hookify rules?

Yes, Hookify rules support multi-condition matching through the conditions field as an alternative to single regex patterns. This allows you to combine multiple matching criteria to detect complex bash or file events before presenting warnings or blocks to the agent.

Where do I place Hookify rule files for agent safety interception?

Hookify rule files must be placed as .claude/hookify.{rule-name}.local.md files in your local environment. This specific file naming and placement ensures the tool interception layer correctly loads and applies your safety rules during agent operations.

How do I test Hookify rules for file edit detection?

Testing Hookify rules for file edit detection involves creating the .claude/hookify.{rule-name}.local.md file with proper YAML frontmatter, then triggering the target file event to verify the rule fires. The skill provides instructions on how to test resulting rule files for correct pattern matching and message display.