Token导航 LogoToken导航

Agent Skill · 研究检索

hook-creator(钩子创建者)

hook-creator 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

hook-creator 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描有提醒项,按安装量在研究检索类的 73,675 个 Skill 里排第 62,370。

总安装 336周安装 14GitHub Stars 公开资料未说明下载 112核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:hook-creator(钩子创建者)
来源仓库:https://github.com/vitadynamics/vita-cc-market
仓库路径:skills/hook-creator
安装命令:
npx skills add https://github.com/vitadynamics/vita-cc-market --skill hook-creator
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/vitadynamics/vita-cc-market --skill hook-creator

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于查找、检索和筛选相关信息,适合快速定位候选结果。可根据关键词或任务场景提供线索,辅助信息收集与决策支持。

安装命令:npx skills add https://github.com/vitadynamics/vita-cc-market --skill hook-creator 使用前建议确认权限范围和维护状态,避免触发联网或命令执行。注意检查是否会读写文件或修改项目结构。

来源仓库内路径:skills/hook-creator

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/vitadynamics/vita-cc-market --skill hook-creat…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

hook-creator 怎么安装?

在终端执行 npx skills add https://github.com/vitadynamics/vita-cc-market --skill hook-creator。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

hook-creator 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

hook-creator 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

hook-creator 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

hook-creator 用的人多吗?

公开数据是累计安装 336 次,近一周安装 14 次,下载 112 次。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

hook-creator 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
hook-creator

钩子创建者 · 本页

336—接触敏感数据未明确有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Hook Creator

This skill provides comprehensive guidance for creating and managing Claude Code hooks—powerful automation tools that intercept and respond to Claude Code events.

Quick Start

Create a simple PreToolUse hook that validates Bash commands:

# ~/.claude/settings.json or .claude/settings.json
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/validate-command.sh",
            "timeout": 30
          }
        ]
      }
    ]
  }
}
#!/bin/bash
# .claude/hooks/validate-command.sh
input=$(cat)
command=$(echo "$input" | jq -r '.tool_input.command // empty')

# Block destructive commands
if [[ "$command" =~ ^rm\ -rf ]]; then
  echo "Destructive command blocked" >&2
  exit 2
fi

exit 0

What Are Hooks?

Hooks are event-driven automation points that intercept Claude Code execution at specific moments. They receive JSON input via stdin and communicate back through exit codes and stdout.

Hook Capabilities

  • Validate or block tool calls before execution (PreToolUse)
  • Auto-approve permission requests (PermissionRequest)
  • Run post-processing after tool execution (PostToolUse)
  • Add context to conversations (UserPromptSubmit, SessionStart)
  • Control session lifecycle (Stop, SubagentStop)
  • Handle notifications from Claude Code (Notification)
  • Integrate with MCP tools using pattern matching

Hook Types

Command hooks (type: "command"): Execute bash scripts

  • Fast, deterministic, ideal for validation rules
  • Have access to environment variables
  • Return status via exit codes and JSON output

Prompt hooks (type: "prompt"): Use LLM for intelligent decisions

  • Context-aware evaluation
  • Best for complex, nuanced decisions
  • Only supported for Stop and SubagentStop events

Hook Events

PreToolUse

Runs after tool parameters are created but before execution.

Common matchers: Bash, Write, Edit, Read, Task, Glob, Grep

Use cases:

  • Validate or modify tool inputs before execution
  • Auto-approve specific tool calls
  • Block dangerous operations

Decision control:

  • allow: Bypass permission system
  • deny: Prevent tool execution
  • ask: Show user confirmation dialog

PermissionRequest

Runs when user is shown a permission dialog.

Use cases:

  • Auto-approve known-safe operations
  • Deny specific permission requests
  • Modify tool inputs before approval

PostToolUse

Runs immediately after successful tool completion.

Use cases:

  • Trigger notifications or logging
  • Validate tool outputs
  • Add feedback for Claude to consider

UserPromptSubmit

Runs when user submits a prompt, before Claude processes it.

Use cases:

  • Add contextual information to conversations
  • Validate prompts for security issues
  • Block inappropriate prompts

Stop / SubagentStop

Runs when Claude or a subagent finishes responding.

Use cases:

  • Prevent premature stopping
  • Ensure task completion
  • Continue work automatically

SessionStart

Runs when Claude starts or resumes a session.

Matchers: startup, resume, clear, compact

Use cases:

  • Load development context (recent issues, changes)
  • Install dependencies or configure environment
  • Persist environment variables via $CLAUDE_ENV_FILE

SessionEnd

Runs when a Claude Code session ends.

Use cases:

  • Cleanup tasks or logging
  • Save session state or statistics

Notification

Runs when Claude Code sends notifications.

Matchers: permission_prompt, idle_prompt, auth_success, elicitation_dialog

Use cases:

  • Custom notification handling
  • Forward notifications to external systems

Configuration Structure

Basic Structure

{
  "hooks": {
    "EventName": [
      {
        "matcher": "ToolPattern|*",
        "hooks": [
          {
            "type": "command|prompt",
            "command": "bash-command",
            "prompt": "llm-prompt",
            "timeout": 60
          }
        ]
      }
    ]
  }
}

Configuration Locations

Hooks are configured in settings files (priority order):

  1. ~/.claude/settings.json - User settings
  2. .claude/settings.json - Project settings
  3. .claude/settings.local.json - Local project (not committed)
  4. Plugin hooks - Auto-merged when plugins enabled

Matcher Patterns

  • Exact match: Write matches only Write tool
  • Multiple tools: Edit|Write matches Edit or Write
  • Wildcards: .* or * matches all tools
  • Empty/omitted: Matches all tools (for events without matchers)

Environment Variables

Available in all hook commands:

  • $CLAUDE_PROJECT_DIR: Project root directory
  • $CLAUDE_PLUGIN_ROOT: Plugin directory (plugin hooks only)
  • $CLAUDE_CODE_REMOTE: "true" in remote web environment (unset locally)
  • $CLAUDE_ENV_FILE: Persist environment vars (SessionStart only)

Hook Input/Output

Input Format

Hooks receive JSON via stdin:

{
  "session_id": "abc123",
  "transcript_path": "/path/to/session.jsonl",
  "cwd": "/current/working/directory",
  "permission_mode": "default",
  "hook_event_name": "PreToolUse",
  "tool_name": "Bash",
  "tool_input": {
    "command": "echo 'hello'"
  },
  "tool_use_id": "toolu_01ABC123..."
}

Output: Exit Codes

  • 0: Success (stdout shown in verbose mode, except UserPromptSubmit/SessionStart where stdout is added as context)
  • 2: Blocking error (stderr fed back to Claude, blocks action for applicable events)
  • Other: Non-blocking error (stderr shown in verbose mode)

Output: JSON Control

Return structured JSON in stdout for advanced control:

{
  "continue": true,
  "stopReason": "Message shown when stopping",
  "suppressOutput": true,
  "systemMessage": "Warning to user"
}
PreToolUse JSON Output
{
  "hookSpecificOutput": {
    "hookEventName": "PreToolUse",
    "permissionDecision": "allow|deny|ask",
    "permissionDecisionReason": "Explanation",
    "updatedInput": {
      "field_to_modify": "new value"
    }
  }
}
PostToolUse JSON Output
{
  "decision": "block",
  "reason": "Explanation",
  "hookSpecificOutput": {
    "hookEventName": "PostToolUse",
    "additionalContext": "Extra information for Claude"
  }
}
Stop/SubagentStop JSON Output
{
  "decision": "block",
  "reason": "Why Claude should continue (required when blocking)"
}

Common Patterns

Pattern 1: Command Validation

Validate bash commands before execution:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/validate-bash.sh",
            "timeout": 30
          }
        ]
      }
    ]
  }
}
#!/bin/bash
# .claude/hooks/validate-bash.sh
input=$(cat)
command=$(echo "$input" | jq -r '.tool_input.command // empty')

# Enforce better tools
if echo "$command" | grep -qE '\bgrep\b(?!.*\|)'; then
  echo "Use 'rg' (ripgrep) instead of 'grep'" >&2
  exit 2
fi

if echo "$command" | grep -qE '\bfind\s+\S+\s+-name\b'; then
  echo "Use 'rg --files' instead of 'find -name'" >&2
  exit 2
fi

exit 0

Pattern 2: Auto-Approve Safe Operations

Auto-approve documentation file reads:

{
  "hooks": {
    "PermissionRequest": [
      {
        "matcher": "Read",
        "hooks": [
          {
            "type": "command",
            "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/auto-approve-docs.sh"
          }
        ]
      }
    ]
  }
}
#!/usr/bin/env python3
# .claude/hooks/auto-approve-docs.sh
import json
import sys

input_data = json.load(sys.stdin)
file_path = input_data.get("tool_input", {}).get("file_path", "")

# Auto-approve documentation files
if file_path.endswith((".md", ".mdx", ".txt", ".json")):
    output = {
        "hookSpecificOutput": {
            "hookEventName": "PermissionRequest",
            "decision": {
                "behavior": "allow"
            }
        },
        "suppressOutput": True
    }
    print(json.dumps(output))
    sys.exit(0)

sys.exit(0)

Pattern 3: Add Session Context

Load recent changes on session start:

{
  "hooks": {
    "SessionStart": [
      {
        "matcher": "startup|resume",
        "hooks": [
          {
            "type": "command",
            "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/load-context.sh"
          }
        ]
      }
    ]
  }
}
#!/bin/bash
# .claude/hooks/load-context.sh
cd "$CLAUDE_PROJECT_DIR" || exit 0

# Get recent commits (last 5)
recent_changes=$(git log -5 --oneline --pretty=format:"- %s" 2>/dev/null)

# Get current branch
current_branch=$(git branch --show-current 2>/dev/null)

if [ -n "$recent_changes" ] || [ -n "$current_branch" ]; then
  echo "# Repository Context"
  echo ""
  echo "**Current branch:** $current_branch"
  echo ""
  echo "**Recent changes:**"
  echo "$recent_changes"
fi

exit 0

Pattern 4: Prompt-Based Stop Hook

Use LLM to intelligently decide if Claude should stop:

{
  "hooks": {
    "Stop": [
      {
        "hooks": [
          {
            "type": "prompt",
            "prompt": "Analyze the conversation context: $ARGUMENTS\n\nDetermine if:\n1. All requested tasks are complete\n2. All tests pass\n3. No errors remain unaddressed\n\nRespond with JSON: {\"decision\": \"approve\"|\"block\", \"reason\": \"explanation\"}",
            "timeout": 30
          }
        ]
      }
    ]
  }
}

Pattern 5: MCP Tool Integration

Target specific MCP tools:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "mcp__memory__.*",
        "hooks": [
          {
            "type": "command",
            "command": "echo 'Memory operation' >> ~/hooks.log"
          }
        ]
      },
      {
        "matcher": "mcp__.*__write.*",
        "hooks": [
          {
            "type": "command",
            "command": "/path/to/validate-mcp-write.sh"
          }
        ]
      }
    ]
  }
}

Security Considerations

Disclaimer

USE AT YOUR OWN RISK: Hooks execute arbitrary shell commands automatically. You are solely responsible for hook commands. Malicious or poorly written hooks can cause data loss or system damage.

Best Practices

  1. Validate inputs: Never trust input data blindly
  2. Quote variables: Use "$VAR" not $VAR
  3. Block path traversal: Check for .. in file paths
  4. Use absolute paths: Specify full paths via $CLAUDE_PROJECT_DIR
  5. Skip sensitive files: Avoid .env, .git/, keys
  6. Test thoroughly: Test hooks in safe environment first

Configuration Safety

Direct edits to hooks don't take effect immediately. Claude Code:

  1. Captures hook snapshot at startup
  2. Uses snapshot throughout session
  3. Warns if hooks modified externally
  4. Requires review in /hooks menu for changes

Debugging

Basic Troubleshooting

  1. Check configuration: Run /hooks to verify hook registration
  2. Verify syntax: Ensure JSON settings are valid
  3. Test commands: Run hook commands manually first
  4. Check permissions: Ensure scripts are executable (chmod +x)
  5. Review logs: Use claude --debug for execution details

Common Issues

  • Quotes not escaped: Use \" inside JSON strings
  • Wrong matcher: Tool names are case-sensitive
  • Command not found: Use absolute paths for scripts
  • Exit code confusion: Exit code 2 blocks, others warn

Debug Output

Run claude --debug to see detailed hook execution:

[DEBUG] Executing hooks for PostToolUse:Write
[DEBUG] Found 1 hook matchers in settings
[DEBUG] Matched 1 hooks for query "Write"
[DEBUG] Executing hook command: <command> with timeout 60000ms
[DEBUG] Hook command completed with status 0

Plugin Hooks

Plugins can provide hooks that integrate with user/project hooks:

{
  "description": "Automatic code formatting",
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write|Edit",
        "hooks": [
          {
            "type": "command",
            "command": "${CLAUDE_PLUGIN_ROOT}/scripts/format.sh",
            "timeout": 30
          }
        ]
      }
    ]
  }
}

Place in plugins/your-plugin/hooks/hooks.json or specify custom path in plugin metadata.

Execution Details

  • Timeout: 60 seconds default (configurable per command)
  • Parallelization: All matching hooks run in parallel
  • Deduplication: Identical hook commands auto-deduplicated
  • Environment: Current directory with Claude Code's environment
  • Input: JSON via stdin
  • Output: Varies by event (see above)

Guidelines

  • Keep hooks simple: Prefer bash scripts for straightforward logic
  • Use prompt hooks sparingly: Only for nuanced, context-aware decisions
  • Set appropriate timeouts: Adjust based on expected execution time
  • Handle errors explicitly: Scripts should validate inputs and handle errors
  • Test thoroughly: Verify hooks work as expected before production use
  • Document purpose: Add comments explaining hook behavior
  • Use environment variables: Leverage $CLAUDE_PROJECT_DIR for portability

Examples

See examples.md for complete working examples of common hook patterns.

Reference

For complete API details, see:

平台分布

Codex

38.47%
按下载量换算43

Claude

28.92%
按下载量换算32

Cursor

20.17%
按下载量换算23

Gemini CLI

10.27%
按下载量换算12

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills