SKILL

Hook Development

适用于创建 hook、添加 PreToolUse/PostToolUse/Stop hook、验证工具使用、实现基于提示词的 hook、使用 ${CLAUDE_PLUGIN_ROOT}、设置事件驱动自动化或阻止危险命令等请求,也适用于涉及 PreToolUse、PostToolUse、Stop、SubagentStop、SessionStart、SessionEnd、UserPromptSubmit、PreCompact、Notification 等事件的情形。重点介绍 Claude Code 插件 hook 的创建、实现及高级提示词 hook API。

译文已校对
查看英文原文

This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.

适用对象:软件开发与测试。自动收录 · 待核查。

原作者说明节选

从固定版本的 SKILL.md 提取,保留原文语言。以下内容属于作者说明,本站尚未验证安装、兼容或运行结果。

查看英文原文

原文涵盖的主题

  • Hook Development for Claude Code Plugins
  • Overview
  • Hook Types
  • Prompt-Based Hooks (Recommended)
  • Command Hooks
  • Hook Configuration Formats
  • Plugin hooks.json Format
  • Settings Format (Direct)

Hooks are event-driven automation scripts that execute in response to Claude Code events. Use hooks to validate operations, enforce policies, add context, and integrate external tools into workflows. Key capabilities: Validate tool calls before execution (PreToolUse) React to tool results (PostToolUse) Enforce completion standards (Stop, SubagentStop) Load project context (SessionStart) Automate workflows across the development lifecycle Use LLM-driven decision making for context-aware validation: Supported events: Stop, SubagentStop, UserPromptSubmit, PreToolUse Benefits: Context-aware decisions based on natural language reasoning Flexible evaluation logic without bash scripting Better edge case handling Easier to maintain and extend Execute bash commands for deterministic checks: Use for: Fast deterministic validations File system operations External tool integrations Performance-critical checks For plugin hooks in hooks/hooks.json, use wrapper format: Key points: description field is optional hooks field is required wrapper containing actual hook events This is the plugin-specific format Example: For user settings in .claude/settings.json, use direct format: Key points: No wrapp

这里只展示节选,请以完整原文和当前要求为准。

来源仓库
davila7/claude-code-templates
源文件
cli-tool/components/skills/development/hook-development/SKILL.md
固定版本
21be197f100a12b8d0dd9a211cc244c8179f84d3
阅读完整原作者说明 ↗

来源与内容状态

本条为自动发现的元数据,尚未完成人工文档核查;适用性与运行结果待核查。

原作者:davila7/claude-code-templates · 原作者仓库元数据。文档核查:未核查。最近来源检查:2026-11-09T14:01:44.435Z。

分类由名称、说明与路径规则生成,分类不代表已核实适配。

许可与权利归属

MIT。第三方内容及版权归原作者,使用条件以原文为准。

许可原文 ↗

本站没有因同步、复制或用户自报成功而将资源标为运行验证通过。

限制与注意事项

  • 元数据收录不代表本站已经安装、适配、实测或进行安全审查。