Skip to main content

Hook Development

Skill Verified Active

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.

Purpose

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

  1. Identify events to hook into
  2. Choose between prompt-based or command hooks
  3. Write hook configuration in `hooks/hooks.json`
  4. Create hook scripts (for command hooks)
  5. Use portable paths (`${CLAUDE_PLUGIN_ROOT}`)
  6. Validate configuration and scripts
  7. Test hooks thoroughly
  8. 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-plugins

Quality Score

Verified
99 /100
Analyzed about 21 hours ago

Trust Signals

Last commit1 day ago
Stars123.1k
Licensecommercial-terms
Status
View Source

Similar Extensions

Safe Mode

100

Prevent 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.

Skill
rohitg00

Project Session Manager

100

Worktree-first dev environment manager for issues, PRs, and features with optional tmux sessions

Skill
Yeachan-Heo

Public Google Drive

100

Create 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.

Skill
zagmoai

Oh My Claudecode

100

Process-first advisor routing for Claude, Codex, or Gemini via `omc ask`, with artifact capture and no raw CLI assembly

Skill
Yeachan-Heo

Use My Browser

100

Use 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.

Skill
xixu-me

X Twitter Scraper

100

Use 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.

Skill
Xquik-dev

© 2025 SkillRepo · Find the right skill, skip the noise.