Install any skill in seconds. Free to start, no credit card required.
Get Started Free →自動フック実装、イベントドリブン実行、およびルール駆動ワークフロー。
.claude/skills/affaan-m-hookify-rules/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 169% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 106% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 92% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 1% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 25% | 0% |
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/block | warn(默认)显示消息;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 中!
按事件划分的条件字段:
commandfile_path、new_text、old_text、contentuser_prompt运算符: regex_match、contains、equals、not_contains、starts_with、ends_with
所有条件必须同时满足才能触发规则。
匹配 Bash 命令模式:
rm\s+-rf、dd\s+if=、mkfssudo\s+、su\s+chmod\s+777匹配编辑/写入/多重编辑操作:
console\.log\(、debuggereval\(、innerHTML\s*=\.env$、credentials、\.pem$完成检查与提醒。模式 .* 始终匹配。
匹配用户提示内容以强制执行工作流程。
. 转义为 \.,( 转义为 \(\s 空白字符,\d 数字,\w 单词字符+ 一个或多个,* 零个或多个,? 可选| 或运算符log 会匹配 "login"、"dialog"——请使用 console\.log\(rm -rf /tmp——请使用 rm\s+-rf\\sbashpython3 -c "import re; print(re.search(r'your_pattern', 'test text'))"
.claude/ 目录.claude/hookify.{descriptive-name}.local.md.claude/*.local.md 添加到 .gitignore/hookify [description] - 创建新规则(无参数时自动分析对话)/hookify-list - 以表格形式查看所有规则/hookify-configure - 交互式切换规则开关/hookify-help - 完整文档最小可行规则:
markdown--- name: my-rule enabled: true event: bash pattern: dangerous_command --- 此处显示警告信息
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 19,367 | 9,245 | -52% | 1 | 1 | 0% | 1,006 | 2,708 | +169% | 0 | 0 | — |
case-02 | fail→pass | 24,024 | 7,393 | -69% | 1 | 1 | 0% | 1,168 | 2,402 | +106% | 0 | 0 | — |
case-03 | fail→pass | 6,550 | 7,267 | +11% | 1 | 1 | 0% | 1,220 | 2,348 | +92% | 0 | 0 | — |
case-04 | fail→pass | 8,987 | 4,165 | -54% | 1 | 1 | 0% | 1,655 | 1,674 | +1% | 0 | 0 | — |
case-05 | fail→pass | 8,264 | 4,502 | -46% | 1 | 1 | 0% | 1,510 | 1,883 | +25% | 0 | 0 | — |
case-06 | fail→pass | 8,289 | 2,665 | -68% | 1 | 1 | 0% | 1,279 | 1,500 | +17% | 0 | 0 | — |
case-07 | pass→pass | 10,144 | 3,383 | -67% | 1 | 1 | 0% | 1,513 | 1,542 | +2% | 0 | 0 | — |
case-08 | pass→pass | 14,799 | 4,718 | -68% | 1 | 1 | 0% | 2,453 | 1,585 | -35% | 0 | 0 | — |
case-09 | fail→pass | 17,094 | 2,556 | -85% | 1 | 1 | 0% | 909 | 1,376 | +51% | 0 | 0 | — |
case-10 | fail→pass | 8,479 | 2,672 | -68% | 1 | 1 | 0% | 1,356 | 1,409 | +4% | 0 | 0 | — |
case-11 | pass→pass | 9,813 | 7,911 | -19% | 1 | 1 | 0% | 1,673 | 2,276 | +36% | 0 | 0 | — |
case-12 | pass→pass | 11,705 | 6,684 | -43% | 1 | 1 | 0% | 1,900 | 1,939 | +2% | 0 | 0 | — |
case-13 | pass→pass | 11,423 | 7,254 | -36% | 1 | 1 | 0% | 1,777 | 2,296 | +29% | 0 | 0 | — |
case-14 | fail→pass | 7,581 | 2,516 | -67% | 1 | 1 | 0% | 1,186 | 1,400 | +18% | 0 | 0 | — |
case-15 | fail→pass | 7,605 | 1,664 | -78% | 1 | 1 | 0% | 1,250 | 1,266 | +1% | 0 | 0 | — |
case-16 | fail→pass | 9,847 | 1,460 | -85% | 1 | 1 | 0% | 1,550 | 1,201 | -23% | 0 | 0 | — |
case-17 | fail→pass | 12,690 | 1,938 | -85% | 1 | 1 | 0% | 1,972 | 1,310 | -34% | 0 | 0 | — |
case-18 | pass→pass | 15,843 | 2,218 | -86% | 1 | 1 | 0% | 2,325 | 1,326 | -43% | 0 | 0 | — |
case-19 | fail→pass | 9,087 | 3,159 | -65% | 1 | 1 | 0% | 1,377 | 1,509 | +10% | 0 | 0 | — |
case-20 | pass→pass | 3,685 | 4,303 | +17% | 1 | 1 | 0% | 560 | 1,728 | +209% | 0 | 0 | — |
case-21 | fail→fail | 11,481 | 10,177 | -11% | 1 | 1 | 0% | 1,953 | 2,881 | +48% | 0 | 0 | — |
case-22 | pass→pass | 4,084 | 3,710 | -9% | 1 | 1 | 0% | 764 | 1,652 | +116% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 19 counted toward the lift figure. The other 3 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +59 percentage points is the difference between those two pass rates over the 19 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.