Hook Development

仓库创建 2026年1月12日最近提交 4 天前SkillHot 收录 21 天前
▸ 精选理由

可在工具调用前后注入策略与安全检查,方便集成自动化。

▸ 风险提示

钩子可能执行外部操作,需注意权限与不信任输入。

这个 Skill 做什么

在 Claude Code 插件中创建 Pre/Post/Stop 钩子以扩展与校验调用。

通过注册事件钩子(如 PreToolUse、PostToolUse、Stop 等)把自动化规则和校验挂到 Claude Code 插件里,能在工具调用前验证、调用后处理或阻断危险操作。要实现基于 prompt 的高级钩子、事件驱动自动化或策略强制时用它,方便把外部系统和调用流程串起来。

▸ 展开 SKILL.md 英文原文

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.

开发编程钩子开发事件驱动安全校验Claude Code
431
Stars
37
Forks
30
仓库内 Skill
+16
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/tzachbon/smart-ralph/main/.agents/skills/Hook Development/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/tzachbon/smart-ralph/main/.agents/skills/Hook Development/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# Hook Development for Claude Code Plugins

## Overview

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

## Hook Types

### Prompt-Based Hooks (Recommended)

Use LLM-driven decision making for context-aware validation:

```json
{
  "type": "prompt",
  "prompt": "Evaluate if this tool use i
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有