Writing Hookify Rules

Create and manage Hookify rules for agent behavior modification.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/tktaf/codex --skill writing-hookify-rules-tktaf
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Writing Hookify Rules
Source: https://github.com/tktaf/codex/tree/main/skills/writing-rules
Command: npx skills add https://github.com/tktaf/codex --skill writing-hookify-rules-tktaf

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance and examples for creating, refining, and managing Hookify rules, enabling users to effectively customize agent behavior and enforce project standards.

Core Features & Use Cases

  • Rule Definition: Learn the structure and syntax for defining Hookify rules, including frontmatter fields like name, event, pattern, and conditions.
  • Event Handling: Understand how to trigger rules based on different events (bash, file, stop, prompt).
  • Pattern Matching: Master the use of regex for precise pattern matching in commands, file content, and user prompts.
  • Use Case: A developer needs to ensure that no sensitive API keys are accidentally committed to version control. They use this Skill to learn how to write a file event Hookify rule that checks for patterns like API_KEY in .env files and warns or blocks the commit.

Quick Start

Use the writing hookify rules skill to create a new rule that warns about the use of rm -rf in bash commands.

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 rules to modify agent behavior and enforce coding standards?

To modify agent behavior and enforce coding standards, write rules with frontmatter fields like `name`, `event`, `pattern`, and `conditions`, configuring logic to warn or block specific actions during events.

How does pattern matching work for blocking sensitive API keys in file events?

Pattern matching for blocking sensitive API keys uses regex within `file` event rules to precisely check for string patterns like `API_KEY` in targeted files, enabling the system to warn or block the commit.

What events can I trigger Hookify rules on for workflow automation?

You can trigger Hookify rules on four event types for workflow automation: `bash` for commands, `file` for content changes, `stop` for halting actions, and `prompt` for user inputs.

Can I use regex to prevent dangerous bash commands like rm -rf?

Yes, you can use regex to prevent dangerous bash commands by creating a `bash` event rule that matches the `rm -rf` pattern, warning or blocking execution before the command proceeds.

What is the best way to structure advanced condition logic for security policies?

The best way to structure advanced condition logic for security policies is to define specific regex patterns within the `conditions` field of your rule frontmatter, ensuring precise matching for violations.