Agent skill

Hookify Rules

by affaan-m in affaan-m/ECC

当用户要求创建hookify规则、编写hook规则、配置hookify、添加hookify规则或需要关于hookify规则语法和模式的指导时,应使用此技能。

MITAuto-check: notesAgent Workflows

Install Hookify Rules

skills CLI
$ npx skills add affaan-m/ECC --skill hookify-rules -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install affaan-m/ECC hookify-rules --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/affaan-m/ECC.git skills-src && mkdir -p .claude/skills && cp -r skills-src/docs/zh-CN/skills/hookify-rules .claude/skills/hookify-rules && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
hookify-rules
GitHub stars
275k
Token cost
~605 tokens
SKILL.md length
120 words
Files
1
Skills in repo
645
Repo updated
First seen
Licence
MIT

At a glance

当用户要求创建hookify规则、编写hook规则、配置hookify、添加hookify规则或需要关于hookify规则语法和模式的指导时,应使用此技能。

  • Tasks that involve Hooks and plugins
  • SKILL.md covers 概述, 规则文件格式, 事件类型指南 and 模式编写技巧, plus 3 more sections
  • Calls python3; needs API_KEY

What it does

Hookify Rules is an agent skill from affaan-m/ECC. 当用户要求创建hookify规则、编写hook规则、配置hookify、添加hookify规则或需要关于hookify规则语法和模式的指导时,应使用此技能。

Its SKILL.md is about 610 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Agent Workflows, covering Hooks and plugins. It works with Bash. The repository describes itself as: The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond. The licence is MIT.

When your agent uses it

  • Tasks that involve Hooks and plugins

Example prompts

  • “/hookify-rules”

Requirements

  • Python 3
  • A credential in API_KEY

What it can do on your machine

Read from SKILL.md and the folder at commit ef648e0. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • python3

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • API_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Hookify Rules loads about 605 tokens when it runs. Until then it costs about 23 tokens; SKILL.md has 120 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~23
When it runs · the whole SKILL.md, loaded when a task matches
~605

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:54
    你正在向 .env 文件中添加 API 密钥。请确保该文件已包含在 .gitignore 中!

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from affaan-m/ECC at commit ef648e0, republished under its MIT licence (© affaan-m). 120 words, ~605 tokens.

Download SKILL.mdSave it as .claude/skills/hookify-rules/SKILL.md (or your agent's skills folder).
name
hookify-rules
description
当用户要求创建hookify规则、编写hook规则、配置hookify、添加hookify规则或需要关于hookify规则语法和模式的指导时,应使用此技能。

编写 Hookify 规则

概述

Hookify 规则是带有 YAML 前置元数据的 Markdown 文件,用于定义要监控的模式以及匹配时显示的消息。规则存储在 .claude/hookify.{rule-name}.local.md 文件中。

规则文件格式

基本结构
markdown
---
name: rule-identifier
enabled: true
event: bash|file|stop|prompt|all
pattern: regex-pattern-here
---

当此规则触发时向 Claude 显示的消息。
可包含 Markdown 格式、警告、建议等内容。
前置元数据字段
字段必填值描述
name是kebab-case 字符串唯一标识符(动词优先:warn-、block-、require-*)
enabled是true/false无需删除即可切换
event是bash/file/stop/prompt/all触发规则的钩子事件
action否warn/blockwarn(默认)显示消息;block 阻止操作
pattern是*正则表达式字符串要匹配的模式(*或使用 conditions 实现复杂规则)
高级格式(多条件)
markdown
---
name: warn-env-api-keys
enabled: true
event: file
conditions:
  - field: file_path
    operator: regex_match
    pattern: \.env$
  - field: new_text
    operator: contains
    pattern: API_KEY
---

你正在向 .env 文件中添加 API 密钥。请确保该文件已包含在 .gitignore 中!

按事件划分的条件字段:

  • bash:command
  • file:file_path、new_text、old_text、content
  • prompt:user_prompt

运算符: regex_match、contains、equals、not_contains、starts_with、ends_with

所有条件必须同时满足才能触发规则。

事件类型指南

bash 事件

匹配 Bash 命令模式:

  • 危险命令:rm\s+-rf、dd\s+if=、mkfs
  • 权限提升:sudo\s+、su\s+
  • 权限问题:chmod\s+777
file 事件

匹配编辑/写入/多重编辑操作:

  • 调试代码:console\.log\(、debugger
  • 安全风险:eval\(、innerHTML\s*=
  • 敏感文件:\.env$、credentials、\.pem$
stop 事件

完成检查与提醒。模式 .* 始终匹配。

prompt 事件

匹配用户提示内容以强制执行工作流程。

模式编写技巧

正则表达式基础
  • 转义特殊字符:. 转义为 \.,( 转义为 \(
  • \s 空白字符,\d 数字,\w 单词字符
  • + 一个或多个,* 零个或多个,? 可选
  • | 或运算符
常见陷阱
  • 过于宽泛:log 会匹配 "login"、"dialog"——请使用 console\.log\(
  • 过于具体:rm -rf /tmp——请使用 rm\s+-rf
  • YAML 转义:使用无引号模式;带引号的字符串需要 \\s
测试
bash
python3 -c "import re; print(re.search(r'your_pattern', 'test text'))"

文件组织

  • 位置:项目根目录下的 .claude/ 目录
  • 命名:.claude/hookify.{descriptive-name}.local.md
  • Gitignore:将 .claude/*.local.md 添加到 .gitignore

命令

  • /hookify [description] - 创建新规则(无参数时自动分析对话)
  • /hookify-list - 以表格形式查看所有规则
  • /hookify-configure - 交互式切换规则开关
  • /hookify-help - 完整文档

快速参考

最小可行规则:

markdown
---
name: my-rule
enabled: true
event: bash
pattern: dangerous_command
---
此处显示警告信息

© affaan-m, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in docs/zh-CN/skills/hookify-rules of affaan-m/ECC.

Open the folder on GitHubat commit ef648e0

Compare with similar skills

Hookify Rules next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Hookify Rules compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Hookify Rules this skillaffaan-m/ECC275k—~605Automated safety check: NotesMIT
Hook Development for Claude Code Pluginsanthropics/claude-plugins-official38k11 repos~4.1kAutomated safety check: NotesApache-2.0
Plugin Settings Patternanthropics/claude-plugins-official38k7 repos~3kAutomated safety check: PassApache-2.0
Crush Configurationcharmbracelet/crush29k—~3.7kAutomated safety check: PassCustom licence
Verify Setup Health Checkdiet103/claude-code-infrastructure-showcase10k—~363Automated safety check: PassMIT
Claude SmartReflexioAI/claude-smart783—~439Automated safety check: PassApache-2.0

Similar skills

  • Hook Development for Claude Code Plugins

    anthropics/claude-plugins-official

    Official

    Explains how to write Claude Code plugin hooks, both prompt-based checks and bash commands, for events such as PreToolUse, Stop and SessionStart.

    38k GitHub starsUsed in 11 repos~4.1k tokens
    Agent WorkflowsAuto-check: notes
  • Plugin Settings Pattern

    anthropics/claude-plugins-official

    Official

    Shows how Claude Code plugins keep per-project settings and state in .claude/plugin-name.local.md files with YAML frontmatter and a markdown body.

    38k GitHub starsUsed in 7 repos~3k tokens
    Agent WorkflowsAuto-check passed
  • Crush Configuration

    charmbracelet/crush

    Explains how to configure the Crush coding agent with crushrc or crush.json, covering providers, models, LSPs, MCP servers, hooks, permissions and config precedence.

    29k GitHub stars~3.7k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed
  • Verify Setup Health Check

    diet103/claude-code-infrastructure-showcase

    Run the infrastructure health check and fix anything that fails

    10k GitHub stars~363 tokensUpdated 2 mo ago
    Agent WorkflowsAuto-check passed
  • Claude Smart

    ReflexioAI/claude-smart

    Codex-only — use when the user asks to run claude-smart commands in Codex, including claude-smart show, learn, restart, dashboard, clear-all, or slash-like requests such as /claude-smart:learn.

    783 GitHub stars~439 tokensUpdated 2 days ago
    Agent WorkflowsAuto-check passed
  • Hook Creator

    greatSumini/cc-system

    Create and configure Claude Code hooks for customizing agent behavior.

    438 GitHub stars~662 tokensUpdated 4 mo ago
    Agent WorkflowsAuto-check: notes

More from affaan-m/ECC

All 645 skills in this repo
  • Videodb

    affaan-m/ECC

    Ingest, index, search, edit, and monitor video and audio with the VideoDB Python SDK — upload from files, URLs, or RTSP feeds, build spoken and scene indexes with timestamped search and playable…

    275k GitHub starsUsed in 3 repos~3.5k tokens
    Auto-check: notes
  • Rules Distillation

    affaan-m/ECC

    Scans installed skills for principles that recur across them and proposes rule-file changes: append, revise, add a section, create a file or leave as covered.

    275k GitHub starsUsed in 2 repos~2.3k tokens
    Auto-check passed
  • Builds DRAFT counterparty agreements from one markdown template and a small JSON spec per party, with clauses picked by the party's role.

    275k GitHub stars~2.9k tokensUpdated 3 days ago
    Auto-check passed
  • Measures whether agents actually follow a skill, rule or agent definition by generating scenarios at three strictness levels and scoring tool-call traces.

    275k GitHub starsUsed in 1 repo~623 tokens
    Auto-check passed
  • Instinct-based learning system that observes sessions via hooks, creates atomic instincts with confidence scoring, and evolves them into skills/commands/agents.

    275k GitHub stars~3.5k tokensUpdated 3 days ago
    Auto-check passed
  • Adds one optional external Codex critique that tries to break a council's decision draft, sent to OpenAI only after you consent.

    275k GitHub stars~1.5k tokensUpdated 3 days ago
    Auto-check passed

Works with

Categories

Questions about Hookify Rules

What does Hookify Rules do?

当用户要求创建hookify规则、编写hook规则、配置hookify、添加hookify规则或需要关于hookify规则语法和模式的指导时,应使用此技能。. Hookify Rules is an agent skill from affaan-m/ECC.

When should I use Hookify Rules?

Hookify Rules fits situations like: tasks that involve Hooks and plugins.

How do I install Hookify Rules in Claude Code?

Run `npx skills add affaan-m/ECC --skill hookify-rules -a claude-code`. Or copy the skill folder (docs/zh-CN/skills/hookify-rules in affaan-m/ECC) into .claude/skills/hookify-rules in your project. Claude Code loads it when a task matches its description.

How do I install Hookify Rules in Codex?

Run `npx skills add affaan-m/ECC --skill hookify-rules -a codex`. Or copy the skill folder (docs/zh-CN/skills/hookify-rules in affaan-m/ECC) into .agents/skills/hookify-rules in your project. Codex loads it when a task matches its description.

Can I use Hookify Rules in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add affaan-m/ECC --skill hookify-rules -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/hookify-rules, .gemini/skills/hookify-rules, .github/skills/hookify-rules and .opencode/skills/hookify-rules in your project.

What does Hookify Rules need to run?

Going by SKILL.md and its folder, Hookify Rules needs the command-line tools its instructions call (python3) and credentials named API_KEY. Our summary lists: Python 3; A credential in API_KEY.

Does Hookify Rules access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Hookify Rules safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Hookify Rules use?

Hookify Rules is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Hookify Rules use?

About 605 tokens (SKILL.md is roughly 2.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Hookify Rules?

Skills that share tags, products or a category with Hookify Rules: Hook Development for Claude Code Plugins (anthropics/claude-plugins-official, 38k stars), Plugin Settings Pattern (anthropics/claude-plugins-official, 38k stars), Crush Configuration (charmbracelet/crush, 29k stars) and Verify Setup Health Check (diet103/claude-code-infrastructure-showcase, 10k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Hookify Rules?

affaan-m (a GitHub user) maintains it in affaan-m/ECC, which has 275,023 GitHub stars. The repository holds 645 skills in this directory. The repository was last updated on October 5, 2026.

Source: affaan-m/ECC on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.