Hook Development
技能 已验证 活跃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.
To guide users in creating robust and secure event-driven automation hooks for Claude Code plugins, enabling advanced workflow control and validation.
功能
- Guidance on prompt-based and command hooks
- Explanation of hook types, events, and configuration
- Security best practices for hook development
- Debugging utilities and testing strategies
- Examples for common hook patterns and scenarios
使用场景
- Implementing validation for tool use (PreToolUse, PostToolUse)
- Setting up event-driven automation for the development lifecycle
- Blocking dangerous commands or sensitive file operations
- Loading project context and environment variables at session start
非目标
- Providing specific hook scripts to copy-paste without understanding
- Handling the core logic of external tools or services
- Replacing the need for fundamental bash or prompt engineering knowledge
工作流
- Identify events to hook into
- Choose between prompt-based or command hooks
- Write hook configuration in `hooks/hooks.json`
- Create hook scripts (for command hooks)
- Use portable paths (`${CLAUDE_PLUGIN_ROOT}`)
- Validate configuration and scripts
- Test hooks thoroughly
- Implement hooks in Claude Code and test with `--debug`
实践
- Security validation
- Test enforcement
- Context loading
- Code quality checks
先决条件
- Claude Code environment
- Basic understanding of bash scripting (for command hooks)
- Basic understanding of prompt engineering (for prompt hooks)
Code Execution
- info:LoggingWhile the extension doesn't directly perform logging, it provides examples of how to implement audit logging for hook actions using bash scripts.
安装
请先添加 Marketplace
/plugin marketplace add anthropics/claude-code/plugin install plugin-dev@claude-code-plugins质量评分
已验证类似扩展
Safe Mode
100Prevent destructive operations using Claude Code hooks. Three modes — cautious (warn on dangerous commands), lockdown (restrict edits to one directory), and clear (remove restrictions). Uses PreToolUse matchers for Bash, Edit, and Write.
Project Session Manager
100Worktree-first dev environment manager for issues, PRs, and features with optional tmux sessions
Public Google Drive
100无需 OAuth 即可创建公开的 Google Docs 或 Google Sheet 文件。使用此技能创建和编辑 Google Docs 和 Sheets,无需登录 Google。文档可通过共享链接查看。首次使用时自动注册。
Oh My Claudecode
100Process-first advisor routing for Claude, Codex, or Gemini via `omc ask`, with artifact capture and no raw CLI assembly
使用我的浏览器
100当工作依赖于用户实时浏览器会话或可见的渲染状态,而不是静态抓取时使用,尤其是在浏览器调试上下文或 DevTools 选择的元素或请求、登录仪表板或 CMS 流程、localhost 应用、上传、下载、媒体检查、DOM 或 iframe 检查、Shadow DOM,或看起来像软 404、身份验证墙、反机器人检查或速率限制的浏览器故障时。
X Twitter Scraper
100当用户需要通过 Xquik 获取 X (Twitter) 数据或执行需要确认的 X 操作时使用:推文搜索、用户查找、关注者提取、媒体下载、监控、Webhook、MCP、SDK、发布、点赞、私信和个人资料更新。需要 Xquik API 密钥。切勿索要 X 登录凭据。