Hook Development
Skill Verified ActiveThis 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.
Features
- 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
Use Cases
- 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
Non-Goals
- 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
Workflow
- 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`
Practices
- Security validation
- Test enforcement
- Context loading
- Code quality checks
Prerequisites
- 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.
Installation
First, add the marketplace
/plugin marketplace add anthropics/claude-code/plugin install plugin-dev@claude-code-pluginsQuality Score
VerifiedTrust Signals
Similar Extensions
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
100Create public Google Docs or Google Sheet files without requiring OAuth. Use this skill to create and edit Google Docs and Sheets, no Google sign-in required. Documents are viewable at shareable links. Registration is automatic on first use.
Oh My Claudecode
100Process-first advisor routing for Claude, Codex, or Gemini via `omc ask`, with artifact capture and no raw CLI assembly
Use My Browser
100Use when work depends on the user's live browser session or visible rendered state rather than static fetches, especially for browser debugging contexts or DevTools-selected elements or requests, logged-in dashboards or CMS flows, localhost apps, forms, uploads, downloads, media inspection, DOM or iframe inspection, Shadow DOM, or browser failures that look like soft 404s, auth walls, anti-bot checks, or rate limits.
X Twitter Scraper
100Use when the user needs X (Twitter) data or confirmation-gated X actions through Xquik: tweet search, user lookup, follower extraction, media download, monitoring, webhooks, MCP, SDKs, posting, likes, DMs, and profile updates. Requires a Xquik API key. Never ask for X login material.