hook-development

Create and manage event-driven hooks for Claude Code plugins.

Updated Jan 13, 2025
One-click install
npx skills add https://github.com/phucle297/dotfiles --skill hook-development-phucle297
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hook-development
Source: https://github.com/phucle297/dotfiles/tree/main/.claude/plugins/marketplaces/claude-plugins-official/plugins/plugin-dev/skills/hook-development
Command: npx skills add https://github.com/phucle297/dotfiles --skill hook-development-phucle297

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This skill solves the challenge of managing and implementing advanced automation scripts in Claude Code plugins. It enables users to validate operations, enforce policies, and integrate tools, streamlining the development workflow.

Core Features & Use Cases

  • Event-Driven Automation: Automate workflows based on Claude Code events like PreToolUse, PostToolUse, and SessionStart.
  • Advanced Prompt-Based Hooks: Utilize LLM-driven decision making for context-aware validation and policy enforcement.
  • Command Hooks: Execute deterministic checks with bash commands for file operations and performance-critical tasks.
  • Plugin Integration: Seamlessly integrate with Claude Code plugins through hooks.json configuration.
  • Use Case: Create a PreToolUse hook to validate code changes before they are committed, ensuring quality standards are met.

Quick Start

Set up a new PreToolUse hook in your plugin to validate code changes: ```bash claude plugin hook setup --type prompt --event PreToolUse --prompt "Does this code change meet the project standards?" --timeout 30

Frequently Asked Questions about hook-development

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up event-driven automation for Claude Code plugins?

Event-driven automation for Claude Code plugins is set up by creating and managing hooks for events like PreToolUse, PostToolUse, and SessionStart through a hooks.json configuration. This enables automated workflows triggered by specific plugin events.

Can I validate code changes before committing using Claude Code hooks?

Yes, you can validate code changes before committing by setting up a PreToolUse hook. This hook uses prompt-based or command checks to enforce project quality standards and validate operations prior to execution.

What is the difference between prompt-based and command hooks in Claude Code?

Prompt-based hooks utilize LLM-driven decision making for context-aware validation, while command hooks execute deterministic bash commands for file operations and performance-critical tasks within your automation workflow.

Do I need a specific environment to parse JSON input for Claude Code hooks?

Yes, implementing these hooks requires the Claude Code plugin environment and the ability to parse JSON input. This setup allows the hooks to process event data and execute validation or policy enforcement correctly.

How do I configure a PreToolUse hook with a specific timeout in Claude Code?

You configure a PreToolUse hook by running the setup command with parameters for type, event, prompt, and timeout. For example, specify a 30-second timeout to limit the validation duration for your code changes.