hook-development

Create and validate event-driven hooks for Codex plugin automation workflows.

Updated Jul 10, 2026
One-click install
npx skills add https://github.com/AvaTar-ArTs/.Agent-skills --skill hook-development-avatar-arts
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: hook-development
Source: https://github.com/AvaTar-ArTs/.Agent-skills/tree/main/skills/hook-development
Command: npx skills add https://github.com/AvaTar-ArTs/.Agent-skills --skill hook-development-avatar-arts

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Building event-driven automation for Codex plugins requires understanding hook events, JSON configuration formats, matchers, and security practices, which is error-prone without structured guidance. ## Core Features & Use Cases - Hook Event Guidance: Covers all hook events including PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, and Notification with configuration examples. - Prompt-Based and Command Hooks: Explains when to use LLM-driven prompt hooks versus deterministic bash command hooks, including output formats and exit codes. - Security and Debugging Practices: Provides input validation patterns, path safety checks, ${CLAUDE_PLUGIN_ROOT} portability, and debugging workflows with Codex --debug. - Use Case: When building a plugin that must block dangerous file writes, use this Skill to configure a PreToolUse hook with a Write|Edit matcher that validates paths and denies sensitive file access. ## Quick Start Ask the AI to create a PreToolUse hook that validates file writes and blocks access to sensitive files in your Codex plugin.

Frequently Asked Questions about hook-development

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

FAQPage Schema
How do I create a PreToolUse hook in a Codex plugin?▼

Define the hook in hooks/hooks.json under the PreToolUse event with a matcher like Write|Edit and a hooks array containing a prompt or command type. Wrap events in a top-level hooks object for the plugin format.

What is the difference between prompt-based and command hooks?▼

Prompt-based hooks use LLM reasoning for context-aware decisions on events like Stop and PreToolUse, while command hooks run bash scripts for fast deterministic checks. Use prompt hooks for complex logic and command hooks for performance-critical validation.

Why are my hook changes not taking effect in Codex?▼

Hooks load only at session start, so editing hooks.json or scripts does not affect the running session. Exit Codex and restart it, then verify loaded hooks with the /hooks command or Codex --debug.

How do I block dangerous commands with a hook?▼

Use a PreToolUse command hook that parses the JSON stdin input, checks tool_input for path traversal or sensitive files, and exits with code 2 plus a deny decision on stderr. Always quote bash variables and validate inputs.

What is ${CLAUDE_PLUGIN_ROOT} used for in hooks?▼

${CLAUDE_PLUGIN_ROOT} is an environment variable pointing to the plugin directory, used in hook commands for portable paths. Referencing scripts through it ensures hooks work regardless of where the plugin is installed.