Writing Hookify Rules

Generate hookify rule definitions with YAML frontmatter and regex patterns.

Updated Dec 19, 2025
One-click install
npx skills add https://github.com/ecielam/claude-files --skill writing-hookify-rules-ecielam
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Writing Hookify Rules
Source: https://github.com/ecielam/claude-files/tree/main/plugins/cache/claude-code-plugins/hookify/0.1.0/skills/writing-rules
Command: npx skills add https://github.com/ecielam/claude-files --skill writing-hookify-rules-ecielam

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates manual code review and security oversight by automatically enforcing custom rules and patterns across all Claude Code interactions.

Core Features & Use Cases

  • Custom Rule Creation: Define patterns to watch for dangerous commands, security issues, and process violations.
  • Proactive Safety Nets: Create intelligent hooks that warn about dangerous rm commands, console.log in production code, and missing deployment checklists.

Quick Start

Create a hookify rule to warn about dangerous bash commands by adding a file '.claude/hookify.dangerous-rm.local.md' with content:

name: warn-dangerous-rm enabled: true event: bash pattern: rm\s+-rf Message: "Dangerous command detected! Consider using safer alternatives."

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 hookify rules to enforce code safety checks?

Hookify rules detect patterns in file edits and prompts by matching regex against bash, file, stop, and prompt events. Define a YAML frontmatter with name, enabled, event, and action fields, then specify a regex pattern and the message shown when triggered. Rules execute automatically during Claude Code interactions without manual review.

What events can hookify rules monitor?

Hookify rules support bash, file, stop, and prompt events. Bash events catch dangerous commands like rm -rf. File events monitor edits to specific patterns. Prompt events intercept user inputs. Stop events halt execution when conditions match, providing layered workflow enforcement across all interaction types.

Can I create multi-condition hookify rules?

Yes, hookify rules support multi-condition patterns beyond single regex matches. Define conditions with field, operator, and pattern fields in YAML frontmatter to combine multiple checks. This enables complex enforcement logic—for example, detecting console.log only in production files or flagging missing deployment checklist entries.

How do I warn about dangerous commands in hookify rules?

Create a hookify rule with event set to bash and pattern set to your regex—such as rm\s+-rf for recursive deletes. Set action to warn or stop, then write a message shown when the pattern matches. Store the rule as a .claude/hookify.{rulename}.local.md file to activate it automatically.

What's the difference between warn and stop actions in hookify rules?

Warn actions display a message when a rule triggers but allow execution to continue, useful for code style guidance. Stop actions halt execution and block the operation, appropriate for security violations or process enforcement. Choose based on whether the pattern is advisory or mandatory.

Do I need custom code to deploy hookify rules?

No, hookify rules use declarative YAML frontmatter and markdown, requiring no custom code. Write the rule definition directly in a .claude/hookify.{name}.local.md file in your workspace. Rules activate automatically without build steps or configuration beyond the markdown file.