Writing Hookify Rules

Writing Hookify Rules is a skill for Claude Code from Poorgramer-Zack/copilot-cli-things. It costs 67 tokens per session (2,249 once invoked), scanned D, original, MIT.

A reference for writing Hookify rules, which are Markdown files with YAML settings that watch agent events for matching text or commands.

In plain words
What is it for?
Use it to create rules that respond to shell commands, file edits, stop attempts, user prompts, or all of these events.
Why use it?
It explains the required file format, event choices, regular-expression patterns, and whether a match should warn or block an action.

Skill for Claude Code

Written for Claude Code: PreToolUse hook event.

Good fit Use it to create rules that respond to shell commands, file edits, stop attempts, user prompts, or all of these events.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/poorgramer-zack/copilot-cli-things/writing-rules
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Poorgramer-Zack/copilot-cli-things --skill writing-rules
Clone the repo
git clone --depth 1 https://github.com/Poorgramer-Zack/copilot-cli-things

Made for: Claude Code.

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/poorgramer-zack/copilot-cli-things/writing-rules/github.svg)](https://agentmods.dev/skills/poorgramer-zack/copilot-cli-things/writing-rules)
Your own site
<a href="https://agentmods.dev/skills/poorgramer-zack/copilot-cli-things/writing-rules"><img src="https://agentmods.dev/badge/skills/poorgramer-zack/copilot-cli-things/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/poorgramer-zack/copilot-cli-things/writing-rules"><img src="https://agentmods.dev/badge/skills/poorgramer-zack/copilot-cli-things/writing-rules.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 67 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,249 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 original No closer match found 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.00067 $0.02249
Opus 5.5 $0.00027 $0.00900
Sonnet 5.5 $0.00013 $0.00450
Haiku 4.5 $0.00007 $0.00225

Measured 2mo ago against content hash ee42089c10d1, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 2mo 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
plugins/hookify/skills/writing-rules/SKILL.md · 373 lines

How it starts

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

Writing Hookify Rules

Define hookify rules as .github/hookify.{rule-name}.local.md files — markdown with YAML frontmatter specifying patterns to watch for and messages to display on match.

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 · 373 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. 2mo ago First seen · 373 lines · 67 tokens per session scan D ee42089c10d1

Subscribe to this mod's changes

Writing Hookify Rules is a skill published in the GitHub repository Poorgramer-Zack/copilot-cli-things (2 stars, last pushed 7mo ago), licensed MIT. It adds 67 tokens to every session and 2,249 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it D with 2 findings (asks for root, recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

speckit-init

Scaffold a Spec Kit (spec-driven development) project for GitHub Copilot by running specify init --integration copilot --integration-options="--skills". USE FOR: starting a new spec-kit project, bootstrapping spec-driven development in an existing repo, installing spec-kit templates/scripts/commands for Copilot. DO…

github/spec-kit-copilot · 113 tokens

speckit-extension

Manage Spec Kit extensions via specify extension. USE FOR: listing installed extensions as text or JSON, installing/removing/updating extensions, searching the extension catalog, showing extension info, enabling/disabling extensions, setting resolution priority, or managing extension catalogs. DO NOT USE FOR: artifact…

github/spec-kit-copilot · 100 tokens

speckit-preset

Manage Spec Kit presets via specify preset. USE FOR: listing installed presets as text or JSON, installing/removing presets, searching the preset catalog, showing preset info, resolving which template a preset name maps to, enabling/disabling presets, setting resolution priority, or managing preset catalogs. DO NOT…

github/spec-kit-copilot · 108 tokens

speckit-artifact

Inspect the effective Spec Kit artifact inventory and composition stacks via specify artifact. USE FOR: listing commands/templates/scripts/hooks, explaining which preset or extension layer supplies an artifact, inspecting resolution precedence and hidden layers, checking hook registration, or resolving a stack…

github/spec-kit-copilot · 105 tokens

speckit-bundle

Discover, install, and author Spec Kit bundles via specify bundle. USE FOR: searching/showing/listing bundles, installing/updating/removing a bundle (a curated set of extensions/presets/integrations/workflows), validating a bundle manifest, building a distributable bundle artifact, initializing a project and…

github/spec-kit-copilot · 99 tokens

speckit-workflow

Manage and run Spec Kit automation workflows via specify workflow. USE FOR: running a workflow by ID or local YAML, resuming a paused/failed run, checking run status, listing/installing/removing workflows, searching the workflow catalog, showing a workflow step graph. DO NOT USE FOR: extensions (use…

github/spec-kit-copilot · 93 tokens