跳到正文
cccskills
免费在 GitHub 公开中文介绍

hookify-rules

创建 Hookify 规则,按条件检测命令执行、文件编辑、提示词输入和任务结束事件,对危险操作、敏感文件修改及调试代码发出警告或进行拦截。

原文查看原文说明

Create and configure hookify rules — markdown files with YAML frontmatter that match bash, file, prompt, or stop events by regex or conditions and show warn/block messages to the agent. Use when creating a hookify rule, writing hook rule syntax, configuring hookify, or adding pattern guardrails such as blocking dangerous commands, .env edits, or debug code.

AI 评分100分/ 100查看安装方法

适用场景

  • 拦截危险命令
  • 对敏感文件编辑发出警告
  • 检测编辑时新增的调试代码
  • 在任务结束时显示检查事项
  • 查看规则列表并切换启用状态

中文介绍

功能

此技能创建和配置 Hookify 规则,根据条件检测智能体操作,并发出警告或进行拦截。检测范围包括命令执行、文件编辑、提示词输入和任务结束事件。规则可使用描述文本模式的正则表达式,也可组合多个条件进行判断,并以开头包含配置信息的 Markdown 文件保存在 .claude/ 中。

适用场景

适合拦截危险命令、提醒对 .env 等敏感文件的编辑,或检测新增的调试代码。也可创建在任务结束时显示检查事项的规则,查看现有规则列表,以及切换规则的启用或禁用状态。

使用示例

  • “创建一条规则,拦截匹配 rm -rf 的命令。”
  • “向 .env 添加 API_KEY 时发出警告。”
  • “创建一条规则,检测新增的 console.log(。”

注意事项

启用 ECC hooks 后,规则通过内置 Node 运行时执行,无需单独安装 Hookify 插件或 Python。受 Git 跟踪的本地规则默认禁用。对于无效、过大等规则,系统会输出诊断信息并放行操作,因此不能保证拦截所有操作。

本介绍由 AI(OpenAI Codex)根据公开的 SKILL.md 撰写。准确的规格请查看下方原文。

客观评估

AI 仅根据 SKILL.md 的内容,从 4 个方面进行了评估。星标数和热度不计入评估。

指令清晰度能否看出何时使用、做什么
A良好明确列出支持的事件,并说明 warn 警告和 block 拒绝操作的行为。
步骤具体性步骤、输入输出和示例是否具体
A良好提供规则保存位置、必填字段、多条件示例及创建、查看和切换命令。
安全性发送数据、删除文件、执行命令等是否有说明
A良好说明启用受跟踪规则前须审查,并明确正则表达式时限及异常放行行为。
安装难易度所需工具和 API 密钥是否少且有说明
A良好说明启用 ECC hooks 后使用内置 Node,并提供规则位置、命名和配置方法。

总分按每项 A=25 分、B=15 分、C=5 分相加。 由 AI(OpenAI Codex)于 2026年10月19日 评估。仅供参考,安装前请同时查看原文。

如果您认为评估有误,请申请复核

请写明哪一项有误以及原因。无需登录。我们会对照 SKILL.md 重新评估,并在此处更新结果。

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

包含的文件(1)

  • SKILL.md4.7 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Writing Hookify Rules

Overview

ECC evaluates project-local Hookify rules with its built-in Node runtime. No separate Hookify plugin or Python installation is required when ECC hooks are enabled.

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

FieldRequiredValuesDescription
nameYeskebab-case stringUnique identifier (verb-first: warn-, block-, require-*)
enabledYestrue/falseToggle without deleting
eventYesbash/file/stop/prompt/allWhich hook event triggers this
actionNowarn/blockwarn (default) shows message; block prevents operation
patternYes*regex stringPattern to match (*or use conditions for complex rules)

Advanced Format (Multiple 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
---

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

Condition fields by event:

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

Operators: regex_match, contains, equals, not_contains, starts_with, ends_with

All conditions must match for rule to trigger.

Event Type Guide

bash Events

Match Bash command patterns:

  • Dangerous commands: rm\s+-rf, dd\s+if=, mkfs
  • Privilege escalation: sudo\s+, su\s+
  • Permission issues: chmod\s+777

file Events

Match Edit/Write/MultiEdit operations:

  • Debug code: console\.log\(, debugger
  • Security risks: eval\(, innerHTML\s*=
  • Sensitive files: \.env$, credentials, \.pem$

stop Events

Completion checks and reminders. Pattern .* matches always.

prompt Events

Match user prompt content for workflow enforcement.

Pattern Writing Tips

Regex Basics

  • Escape special chars: . to \., ( to \(
  • \s whitespace, \d digit, \w word char
  • + one or more, * zero or more, ? optional
  • | OR operator

Common Pitfalls

  • Too broad: log matches "login", "dialog" — use console\.log\(
  • Too specific: rm -rf /tmp — use rm\s+-rf
  • YAML escaping: Use unquoted patterns; quoted strings need \\s

Testing

python3 -c "import re; print(re.search(r'your_pattern', 'test text'))"

Avoid nested quantifiers such as (a+)+. The runtime rejects patterns with common catastrophic-backtracking shapes because rules run synchronously in the hook path, and every regex evaluation has a 25 ms hard timeout. Invalid, symlinked, or oversized local rules fail open and emit a diagnostic without disabling other Hookify rules.

Git-tracked local rules are disabled by default. Set ECC_HOOKIFY_ALLOW_TRACKED=1 only after reviewing those files; ordinary gitignored rules created locally remain active without that override.

Runtime Behavior

  • warn injects the message as event-specific additional context and does not block.
  • block denies matching Bash, PowerShell, Write, Edit, or MultiEdit calls before execution.
  • On prompt, post-tool, and stop events, block uses Claude Code's structured block decision.
  • Stop rules skip recursive stop_hook_active events to prevent infinite continuation loops.

File Organization

  • Location: .claude/ directory in project root
  • Naming: .claude/hookify.{descriptive-name}.local.md
  • Gitignore: Add .claude/*.local.md to .gitignore

Commands

  • /hookify [description] - Create new rules (auto-analyzes conversation if no args)
  • /hookify-list - View all rules in table format
  • /hookify-configure - Toggle rules on/off interactively
  • /hookify-help - Full documentation

Quick Reference

Minimum viable rule:

---
name: my-rule
enabled: true
event: bash
pattern: dangerous_command
---
Warning message here

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Design and audit interfaces for Web, iOS, and Android using WCAG 2.2 accessibility guidance. Check screen-reader labels, keyboard navigation, contrast, and control sizes to identify barriers and guide implementation for people using assistive technology.

中文简介正在准备中。当前显示英语简介。

  • Adding descriptive labels to icon-only buttons
  • Reviewing keyboard navigation and modal focus
  • Checking contrast and control sizes
affaan-m/ECC28.4万2026年10月16日 更新

agent-architecture-audit

免费有简介AI 评分 80分

从指令、记忆、工具执行和界面显示等十二个层面排查人工智能代理故障,依据代码和日志梳理原因,按严重程度列出问题并提出修复方案。

  • 排查仅在应用内出现的故障
  • 调查旧对话混入回答的原因
  • 核对工具漏执行或虚报执行
affaan-m/ECC28.4万2026年10月16日 更新

agent-eval

免费有简介AI 评分 80分

用实际开发任务比较多个编程智能体,记录成功率、可获取的API费用、耗时和重复运行的稳定性,为工具选型及更新后的性能评估提供数据。

  • 用实际开发任务比较智能体
  • 采用新工具或模型前进行评估
  • 检查智能体更新后的性能
affaan-m/ECC28.4万2026年10月16日 更新

Design and refine an AI agent’s available actions, tool inputs, and result formats. Define recovery steps for errors, manage the information kept in context, and evaluate changes through completion rates, retries, and cost per successful task.

中文简介正在准备中。当前显示英语简介。

  • Define an AI agent’s tool set and input formats
  • Make tool results and next steps easier to interpret
  • Specify safe retries and stopping conditions
affaan-m/ECC28.4万2026年10月16日 更新

agent-introspection-debugging

免费有简介AI 评分 100分

根据错误信息和执行环境,分析AI代理反复失败或重复操作的原因。通过小范围、可撤销的恢复操作检验假设,并将结果与依据整理成可供交接的报告。

  • 诊断代理连续失败
  • 调查重复调用工具的循环
  • 检查上下文积累导致的输出退化
affaan-m/ECC28.4万2026年10月5日 更新

agent-introspection-debugging

免费有简介AI 评分 100分

在AI代理反复失败或重复操作时,记录错误与环境前提、排查原因,采取影响有限的恢复操作,并汇总结果和证据,为有依据的重试与交接提供支持。

  • 排查重复调用工具的原因
  • 调查对话膨胀导致的质量下降
  • 核对文件路径与环境差异
affaan-m/ECC28.4万2026年10月16日 更新

查看 affaan-m 的全部技能

报告此技能的问题