Writing Hookify Rules

Write Hookify rules with YAML frontmatter and Markdown output.

3|4|Updated Apr 2, 2025
One-click install
npx skills add https://github.com/akiojin/playfab-mcp-server --skill writing-hookify-rules-akiojin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Writing Hookify Rules
Source: https://github.com/akiojin/playfab-mcp-server/tree/main/.claude/skills/writing-rules
Command: npx skills add https://github.com/akiojin/playfab-mcp-server --skill writing-hookify-rules-akiojin

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill empowers you to enforce coding standards, prevent dangerous operations, and ensure best practices by defining custom rules that Claude will follow. It eliminates manual checks and ensures consistency across your projects.

Core Features & Use Cases

  • Pattern-Based Enforcement: Define rules using regex patterns to match specific commands, file edits, or user prompts.
  • Event-Driven Triggers: Activate rules on bash commands, file modifications, agent stop events, or user prompt submissions.
  • Actionable Feedback: Configure rules to warn Claude about potential issues or block operations entirely, guiding it towards safer and more compliant actions.
  • Use Case: Automatically warn Claude if it attempts to add console.log statements to production code, or block it from executing dangerous commands like rm -rf.

Quick Start

Create a Hookify rule to warn me if I try to use sudo in a bash command.

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 Hookify rules to enforce coding standards?

Hookify rules enforce coding standards using YAML frontmatter (name, enabled, event, pattern, conditions) and regex patterns to match specific code, commands, or prompts. Define the event trigger (bash, file, prompt, or stop), set your pattern, and configure the rule to warn or block non-compliant actions, outputting a Markdown document with your rule definition and message body.

What events can trigger a Hookify rule?

Hookify rules trigger on four event types: bash commands, file modifications, user prompt submissions, and agent stop events. Each event type activates pattern matching against the specified regex, allowing you to intercept and respond to different workflow stages with warnings or blocks.

Can I use regex patterns in Hookify rules to match code or commands?

Yes, Hookify rules use regex patterns to match specific commands, file edits, or user prompts. Pattern-based matching lets you target dangerous operations (like rm -rf), unsafe practices (console.log in production), or custom security requirements, then warn or block matches automatically.

How do I configure a Hookify rule to warn versus block?

Hookify rules support two actions: warn and block. Set the action in your rule configuration to warn Claude about potential issues while allowing the operation, or block to prevent the operation entirely. This lets you guide behavior from advisory feedback to hard enforcement.

What's the YAML schema for writing a Hookify rule?

The Hookify rule schema includes name (rule identifier), enabled (boolean), event (bash, file, prompt, or stop), pattern (regex expression), and conditions (filter criteria). Combine these frontmatter fields with your rule message body in a Markdown document to define enforcement logic.

Can I prevent dangerous commands like sudo with Hookify rules?

Yes, Hookify rules can block or warn on dangerous bash commands using regex patterns. Define a rule with event set to bash, pattern matching the command (like sudo), and action set to block or warn, preventing unsafe operations or alerting before execution.