askit-build-hook
Creates and improves event-driven hooks (Advanced tier) for a plugin to the Advanced Skill Library Standard. Use when you need to add a hook, enforce a guard on a tool or session event, inject context, or document a hook's event, scope, and failure behavior.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 3
- Forks
- 0
01 前言 Front Matter
- name
- askit-build-hook
- metadata
- { "tier": "universal", "version": "0.1.0", "audience": "advanced" }
- description
- Creates and improves event-driven hooks (Advanced tier) for a plugin to the Advanced Skill Library Standard. Use when you need to add a hook, enforce a guard on a tool or session event, inject context, or document a hook's event, scope, and failure behavior.
02 资源文件 10
- 参考文档examples/anti-wrong-exit-code.md5.3 KB
- 脚本examples/anti-wrong-exit-code.mjs1.4 KB
- 参考文档examples/golden-1-generated-file-guard.md4.7 KB
- 脚本examples/golden-1-generated-file-guard.mjs3.0 KB
- 参考文档examples/golden-2-trailing-whitespace-formatter.md5.7 KB
- 脚本examples/golden-2-trailing-whitespace-formatter.mjs2.5 KB
- 参考文档examples/golden-3-stop-uncommitted-notifier.md4.7 KB
- 脚本examples/golden-3-stop-uncommitted-notifier.mjs1.9 KB
- 参考文档README.md633 B
- 参考文档references/authoring-hooks.md12.6 KB
03 SKILL.md 正文
askit-build-hook
Purpose
Author a plugin's hooks: event-driven enforcement or context injection (Standard sec 3.5). Hooks are an Advanced-tier capability. Two modes: create scaffolds a hook and its registration; improve raises an existing hook toward the bar (documentation, idempotency, actionable block messages). The hook SKILL is portable; what it authors is primarily a Claude capability (31 events) with a smaller Codex event set. Authoring depth is in references/authoring-hooks.md. Follows the shared builder contract (../../docs/reference/builder-pattern.md).
When to use
When the user asks to add, scaffold, author, or improve a hook (a PreToolUse / PostToolUse / Stop / SessionStart guard, a context injector, or any event-driven automation) for a plugin.
create mode
- Brief interview: the event (for example PreToolUse), the trigger or matcher, the hook type (
command/http/mcp_tool/prompt/agent), the scope (what it guards or injects), and the failure behavior (fail-safe block vs warn). Skip the interview if these are in context. - Author the hook and its registration. A plugin registers hooks in
hooks/hooks.jsonusing${CLAUDE_PLUGIN_ROOT}; copytemplates/hooks.jsonif none exists. Document the event, trigger, scope, and failure behavior (Standard sec 3.5 MUST). - For a blocking hook (for example a PreToolUse deny), write an ACTIONABLE message that states what was blocked and how to proceed. Make the hook idempotent where the event can repeat.
- Register the hook in
library.jsoncomponents.hooksas{ name, version, tier, status }. - Targets: Claude supports 31 events. Codex supports a smaller set (PreToolUse, PostToolUse, Pre/PostCompact, SessionStart, SubagentStart/Stop, UserPromptSubmit, Stop, PermissionRequest). Verify current Codex plugin-hook ingestion at build time (a known caveat) and scope
agent-targetsaccordingly. - Assess with
node scripts/evaluate.mjs . --json. Hook documentation and idempotency are graded at the Advanced tier; the deterministic hook check lands with Gold self-hosting (Phase 5).
improve mode
- Run
node scripts/evaluate.mjs . --jsonand read the report. - Fix what it flags. For hooks specifically, confirm the event / trigger / scope / failure are documented (sec 3.5), the block message is actionable, and the hook is idempotent.
- Re-run to confirm.
Scope
Hooks are Advanced-tier and the most agent-specific component: Claude's event set is the richest, Codex covers a subset, and the wider ecosystem does not support hooks. A hook MUST document its event, trigger, scope, and failure behavior, and a blocking hook MUST emit an actionable message (Standard sec 3.5). Least privilege applies (sec 9): a hook's command runs with the narrowest scope needed.
04 同仓库更多 Skills
fx-demo
A fixture skill that exists so the re-derived manifest has a component list to compare. Use only from tests/unit/self-consistency.test.mjs.
fx-demo
A fixture skill that exists so the re-derived manifest has a component list to compare. Use only from tests/unit/self-consistency.test.mjs.
fx-demo
A fixture skill that exists so the re-derived manifest has a component list to compare. Use only from tests/unit/self-consistency.test.mjs.
sf-caller
Calls the worker subagent to do a thing. Use when delegating work to sf-worker.
sf-do-thing
Converts CSV input into a formatted summary. Use when the user asks to summarize or tabulate spreadsheet data.
root-skill-plugin
Summarizes a changelog section into one release-note sentence. Use when the user asks to condense a list of changelog bullets into a single announcement line.