affaan-m/ECC

hookify-rules

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

64CollectingRuns scripts
See how to use itView GitHub source
npx skills add https://github.com/affaan-m/ECC --skill "docs/zh-CN/skills/hookify-rules"
Automated source guide

Source checked Jul 28, 2026·Refresh due Oct 26, 2026

Reorganized from the pinned upstream SKILL.md

Turn hookify-rules's source instructions into a guide you can follow

According to the pinned SKILL.md from affaan-m/ECC: 当用户要求创建hookify规则、编写hook规则、配置hookify、添加hookify规则或需要关于hookify规则语法和模式的指导时,应使用此技能。

npx skills add https://github.com/affaan-m/ECC --skill "docs/zh-CN/skills/hookify-rules"
Check the pinned source

Best fit

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

Bring this context

  • A concrete task that matches the documented purpose of hookify-rules.
  • The files, examples, or context the task depends on.
  • Your constraints, target environment, and definition of done.

Expected outputs

  • A result that follows the pinned hookify-rules instructions.
  • A concise record of assumptions, inputs used, and unresolved questions.
  • A final check against the source workflow and relevant permission signals.

Key source sections

Read hookify-rules through these 5 source sections

Sections are extracted automatically from the pinned SKILL.md and link back to the source.

01

概述

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

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

规则文件格式

bash:command file:filepath、newtext、oldtext、content prompt:userprompt

SKILL.md · 规则文件格式
bash:commandfile:filepath、newtext、oldtext、contentprompt:userprompt
03

基本结构

Review the “基本结构” section in the pinned source before continuing.

SKILL.md · 基本结构
Review and apply the “基本结构” source section.
04

前置元数据字段

Review the “前置元数据字段” section in the pinned source before continuing.

SKILL.md · 前置元数据字段
Review and apply the “前置元数据字段” source section.
05

高级格式(多条件)

bash:command file:filepath、newtext、oldtext、content prompt:userprompt

SKILL.md · 高级格式(多条件)
bash:commandfile:filepath、newtext、oldtext、contentprompt:userprompt

SkillSignal prompt templates

Provide the task, context, and acceptance criteria

These prompts were written by SkillSignal from the source structure; they are not upstream text.

Task-start prompt

Confirm source fit, inputs, and outputs before acting.

Use hookify-rules to help me with: [specific task]. Context: [files, data, or background]. Constraints: [environment, scope, and prohibited actions]. Before acting, check the pinned SKILL.md and explain which sections apply, what inputs are still missing, and what you will deliver.

Source-guided execution

Make the Agent explicitly follow the key extracted sections.

Apply the pinned hookify-rules source to [task]. Pay particular attention to these source sections: “概述”, “规则文件格式”, “基本结构”, “前置元数据字段”, “高级格式(多条件)”. Preserve the important decision at each step. Mark facts not covered by the source as “needs confirmation” instead of inventing them. Then verify the result against my acceptance criteria: [criteria].

Result-review prompt

Check omissions, permissions, and source drift before delivery.

Review the current hookify-rules result: (1) does it satisfy the original task; (2) were any applicable steps or limits in the pinned SKILL.md missed; (3) did it perform any unauthorized file, command, network, or data action; and (4) which conclusions remain unverified? List issues first, then fix only what the source or user authorization supports.

Output checklist

Verify each item before delivery

The task matches the purpose documented in the SKILL.md.

The source section “概述” has been checked.

The source section “规则文件格式” has been checked.

The source section “基本结构” has been checked.

The source section “前置元数据字段” has been checked.

Inputs, constraints, and acceptance criteria are explicit.

Unverified facts, compatibility, and outcome claims are clearly marked.

Any file, command, network, or data action has been reviewed.

Choose a different workflow

When another Skill is the better fit

hookify-rules

This skill should be used when the user asks to create a hookify rule, write a hook rule, configure hookify, add a hookify rule, or needs guidance on hookify rule syntax and patterns.

A separate implementation from affaan-m/ECC; compare its source, maintenance signals, and permission requirements.

Open source detail

ab-testing

When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "should I test this," "which version is better," "test two versions," "statistical significance," "how long should I run this test," "growth experiments," "experiment velocity," "experiment backlog," "ICE score," "experimentation program

A separate implementation from coreyhaines31/marketingskills; compare its source, maintenance signals, and permission requirements.

Open source detail

churn-prevention

When the user wants to reduce churn, build cancellation flows, set up save offers, recover failed payments, or implement retention strategies. Also use when the user mentions 'churn,' 'cancel flow,' 'offboarding,' 'save offer,' 'dunning,' 'failed payment recovery,' 'win-back,' 'retention,' 'exit survey,' 'pause subscription,' 'involuntary churn,' 'people keep canceling,' 'churn rate is too high,' 'how do I keep users,' or 'customers are leaving.' Use this whenever someone is losing subscribers o

A separate implementation from coreyhaines31/marketingskills; compare its source, maintenance signals, and permission requirements.

Open source detail

FAQ

What does hookify-rules do?

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

How do I start using hookify-rules?

The catalog detected this source-specific install command: npx skills add https://github.com/affaan-m/ECC --skill "docs/zh-CN/skills/hookify-rules". Inspect the command and pinned source before running it.

Which Agent platforms does it declare?

No dedicated Agent platform is declared in the pinned source record.

Repository stars
234,327
Repository forks
35,711
Quality
64/100
Source repository last pushed

Quality breakdown

Based on traceable docs and repository signals; stars are not treated as quality.

64/100
Documentation20/30
Specificity10/25
Maintenance18/20
Trust signals16/25

Compare before choosing

Related Agent Skills and source variants

These links are selected from shared tasks, functions, stacks, platforms, and same-name variants. Compare the source owner, documentation, permissions, and maintenance signals.

hookify-rules by affaan-m

This skill should be used when the user asks to create a hookify rule, write a hook rule, configure hookify, add a hookify rule, or needs guidance on hookify rule syntax and patterns.

ab-testing by coreyhaines31

When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "should I test this," "which version is better," "test two versions," "statistical significance," "how long should I run this test," "growth experiments," "experiment velocity," "experiment backlog," "ICE score," "experimentation program

churn-prevention by coreyhaines31

When the user wants to reduce churn, build cancellation flows, set up save offers, recover failed payments, or implement retention strategies. Also use when the user mentions 'churn,' 'cancel flow,' 'offboarding,' 'save offer,' 'dunning,' 'failed payment recovery,' 'win-back,' 'retention,' 'exit survey,' 'pause subscription,' 'involuntary churn,' 'people keep canceling,' 'churn rate is too high,' 'how do I keep users,' or 'customers are leaving.' Use this whenever someone is losing subscribers o

design-intelligence by event4u-app

Grounded design brief from the adopted corpus — style, WCAG-checked color tokens, typography, layout pattern, anti-patterns. Use on ui-design-brief or any which-style/palette/font/chart decision.

design-system-capture by event4u-app

Write and maintain DESIGN.md + PRODUCT.md — captures visual decisions and interaction patterns so design tasks stay consistent across sessions without re-scanning past work.

View original Skill.mdThis page is parsed directly from the repository SKILL.md without editorial rewriting. Collected: Jul 28, 2026 · about 1 min

编写 Hookify 规则

概述

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

规则文件格式

基本结构

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

当此规则触发时向 Claude 显示的消息。
可包含 Markdown 格式、警告、建议等内容。

前置元数据字段

字段必填描述
namekebab-case 字符串唯一标识符(动词优先:warn-、block-、require-*)
enabledtrue/false无需删除即可切换
eventbash/file/stop/prompt/all触发规则的钩子事件
actionwarn/blockwarn(默认)显示消息;block 阻止操作
pattern是*正则表达式字符串要匹配的模式(*或使用 conditions 实现复杂规则)

高级格式(多条件)

---
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_pathnew_textold_textcontent
  • prompt:user_prompt

运算符: regex_matchcontainsequalsnot_containsstarts_withends_with

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

事件类型指南

bash 事件

匹配 Bash 命令模式:

  • 危险命令:rm\s+-rfdd\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

测试

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 - 完整文档

快速参考

最小可行规则:

---
name: my-rule
enabled: true
event: bash
pattern: dangerous_command
---
此处显示警告信息
Source repo
affaan-m/ECC
Skill path
docs/zh-CN/skills/hookify-rules/SKILL.md
Commit SHA
4e973d3eaf92
Repository license
MIT
Data collected