hook-development

Validate and automate Claude Code plugin hook events with prompt and command hooks.

2|Updated Mar 16, 2026
One-click install
npx skills add https://github.com/hamzaPixl/pixl-ai --skill hook-development-hamzapixl
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hook-development
Source: https://github.com/hamzaPixl/pixl-ai/tree/main/packages/crew/skills/hook-development
Command: npx skills add https://github.com/hamzaPixl/pixl-ai --skill hook-development-hamzapixl

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires jq, and includes scripts (resource) and references (resource) components.

What problem does it solve?

Hooks for Claude Code plugins can be difficult to design, test, and maintain across environments; this Skill provides patterns, scripts, and reference material to validate tool usage, enforce policies, and automate lifecycle events so agents behave safely and predictably.

Core Features & Use Cases

  • PreToolUse & PostToolUse Validation: Approve, deny, or modify tool calls (file writes, bash commands) before or after execution using prompt-based or command hooks.
  • Lifecycle Enforcement: Stop and SubagentStop hooks verify completeness (tests, builds) and SessionStart/SessionEnd hooks load or persist environment context.
  • Utilities & Testing: Built-in scripts to lint hooks, validate hooks.json schema, and run hook tests; examples show write/command validations and load-context patterns.
  • Use Case: Prevent accidental writes to system paths, require tests after code edits, and add project-specific environment variables at session start.

Quick Start

Add a PreToolUse prompt hook that validates file writes and denies operations that touch system paths or contain secrets.

Frequently Asked Questions about hook-development

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

FAQPage Schema
How do I validate tool inputs in Claude Code plugins before execution?

You validate tool inputs in Claude Code plugins by configuring PreToolUse hooks that inspect tool calls and return JSON decisions to approve, deny, or modify operations like file writes and bash commands before they execute.

Can I enforce test or build checks when a Claude Code agent stops?

You can enforce test or build checks using Stop and SubagentStop hooks, which verify session completeness and ensure required validations pass before the agent lifecycle event finishes.

How do I load environment context at the start of a Claude Code session?

You load environment context at the start of a Claude Code session by configuring SessionStart hooks that read environment variables like CLAUDE_PLUGIN_ROOT and CLAUDE_ENV_FILE to persist project-specific context.

Does hook validation require any specific dependencies to run?

Hook validation requires the jq dependency to parse JSON inputs and validate the hooks.json schema, ensuring command hooks execute correctly with parallel semantics and proper environment variable handling.

What is the best way to prevent accidental writes to system paths during automation?

The best way to prevent accidental writes to system paths is implementing PostToolUse and PreToolUse prompt hooks that inspect file write operations and automatically deny operations targeting restricted directories or containing secrets.

Why are my Claude Code plugin hooks not triggering on lifecycle events?

Claude Code plugin hooks fail to trigger on lifecycle events when the hooks.json schema is invalid or parallel hook semantics are misconfigured, requiring schema validation scripts to lint and verify the hook structure.