Writing Hookify Rules

Writing Hookify Rules is a skill for Claude Code from opensesh/karimo-overview. It costs 51 tokens per session (2,254 once invoked), scanned D, a copy of writing-hookify-rules, Apache-2.0.

A guide for writing Hookify rules, which are Markdown files that watch for patterns in prompts, commands, file changes, or stopping actions.

In plain words
What is it for?
Use it to create, enable, disable, and configure rules with events, regular expressions, and warning messages.
Why use it?
It provides the file format and settings needed to show a warning when a chosen pattern matches.

Skill for Claude Code

Written for Claude Code: ${CLAUDE_PLUGIN_ROOT} variable.

Runs only inside its plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else. Install the plugin, not this.

Part of the hookify plugin — 1 skill, 2 commands, 1 agent, 4 hooks shipped together

Good fit Use it to create, enable, disable, and configure rules with events, regular expressions, and warning messages.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.

Claude Code
/plugin marketplace add opensesh/karimo-overview
Claude Code
/plugin install hookify

Made for: Claude Code.

Or install hookify, the plugin that ships this one along with the rest of its 1 skill, 2 commands, 1 agent, 4 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for Writing Hookify Rules

README.md
[![agentmods](https://agentmods.dev/badge/skills/opensesh/karimo-overview/writing-rules/github.svg)](https://agentmods.dev/skills/opensesh/karimo-overview/writing-rules)
Your own site
<a href="https://agentmods.dev/skills/opensesh/karimo-overview/writing-rules"><img src="https://agentmods.dev/badge/skills/opensesh/karimo-overview/writing-rules/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for Writing Hookify Rules

Your own site · 80×15
<a href="https://agentmods.dev/skills/opensesh/karimo-overview/writing-rules"><img src="https://agentmods.dev/badge/skills/opensesh/karimo-overview/writing-rules.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 51 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,254 The whole file, excluding the scripts and references it only reads on demand.
Security scan D 2 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00051 $0.02254
Opus 5 $0.00026 $0.01127
Sonnet 5 $0.00010 $0.00451
Haiku 4.5 $0.00005 $0.00225

Measured 9d ago against content hash cf7a6a0b9209, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade D, and why

Writing Hookify Rules scanned grade D with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

chmod\s+777 Matches: chmod 777, chmod 777

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm\s+-rf Matches: rm -rf, rm -rf
Origin

This is a copy

100% identical to writing-hookify-rules — 2 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.claude/plugins/hookify/skills/writing-rules/SKILL.md · 375 lines

How it starts

The opening of the file, as written. The whole thing — 375 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Writing Hookify Rules

Overview

Hookify rules are markdown files with YAML frontmatter that define patterns to watch for and messages to show when those patterns match. Rules are stored in .claude/hookify.{rule-name}.local.md files.

Rule File Format

Basic Structure

---
name: rule-identifier
enabled: true
event: bash|file|stop|prompt|all
pattern: regex-pattern-here
---

Message to show Claude when this rule triggers.
Can include markdown formatting, warnings, suggestions, etc.

Frontmatter Fields

name (required): Unique identifier for the rule

  • Use kebab-case: warn-dangerous-rm, block-console-log
  • Be descriptive and action-oriented
  • Start with verb: warn, prevent, block, require, check

enabled (required): Boolean to activate/deactivate

  • true: Rule is active
  • false: Rule is disabled (won't trigger)
  • Can toggle without deleting rule

event (required): Which hook event to trigger on

  • bash: Bash tool commands
  • file: Edit, Write, MultiEdit tools
  • stop: When agent wants to stop
  • prompt: When user submits a prompt
  • all: All events

action (optional): What to do when rule matches

  • warn: Show message but allow operation (default)
  • block: Prevent operation (PreToolUse) or stop session (Stop events)
  • If omitted, defaults to warn

pattern (simple format): Regex pattern to match

  • Used for simple single-condition rules
  • Matches against command (bash) or new_text (file)
  • Python regex syntax

Example:

event: bash
pattern: rm\s+-rf

Advanced Format (Multiple Conditions)

For complex rules with multiple conditions:

---
name: warn-env-file-edits
enabled: true
event: file
conditions:
  - field: file_path
    operator: regex_match
    pattern: \.env$
  - field: new_text
    operator: contains
    pattern: API_KEY
---

You're adding an API key to a .env file. Ensure this file is in .gitignore!

Condition fields:

  • field: Which field to check
    • For bash: command
    • For file: file_path, new_text, old_text, content
  • operator: How to match
    • regex_match: Regex pattern matching
    • contains: Substring check
    • equals: Exact match
    • not_contains: Substring must NOT be present
    • starts_with: Prefix check
    • ends_with: Suffix check
  • pattern: Pattern or string to match

Read the full file on GitHub · 375 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 375 lines · 51 tokens per session scan D cf7a6a0b9209

Subscribe to this mod's changes

Writing Hookify Rules is a skill published in the GitHub repository opensesh/karimo-overview (11 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 51 tokens to every session and 2,254 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it D with 2 findings (asks for root, recursive force delete). It is 100% identical to writing-hookify-rules, differing in 2 lines, and is treated as a copy.

Related

Other skills, from other repositories

multi-agent

A process for coordinating multiple coding agents by splitting work among scouts, workers, reviewers, and repair agents. Each agent has a defined role and task.

fengshao1227/ccg-workflow · 49 tokens

task-management

Use before any Worker taskflow call or assigned-task workflow, including reading task state, acknowledging a task, executing a task, tracking progress, handling blockers/questions, submitting structured results, or reporting completion. Always use this skill when the message mentions assigned task, task ID…

agentscope-ai/AgentTeams · 89 tokens

task-coordination

Coordinate access to shared task directories using .processing marker files. Use before accessing a Worker's workspace to prevent conflicts when both Manager and Worker might modify files simultaneously.

agentscope-ai/AgentTeams · 36 tokens

verify-security

A security-checking skill that scans source code for common dangerous patterns and records security decisions. It covers issues such as injection, exposed keys, unsafe file paths, and cross-site scripting.

fengshao1227/ccg-workflow · 78 tokens

liquid-glass

Apple Liquid Glass design system. Use when building UI with translucent, depth-aware glass morphism following Apple's design language. Provides CSS tokens, component patterns, dark/light mode, and animation specs.

fengshao1227/ccg-workflow · 43 tokens

project-management

Use when admin asks to start a multi-worker project, when a Worker @mentions you with task completion in a project room, when project plan changes are needed, or when a blocked task needs resolution.

agentscope-ai/AgentTeams · 43 tokens