hook-authoring

Author secure policy-driven hooks for Claude Code and Agent SDK events.

326|35|Updated Nov 23, 2025
One-click install
npx skills add https://github.com/athola/claude-night-market --skill hook-authoring
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hook-authoring
Source: https://github.com/athola/claude-night-market/tree/main/plugins/abstract/skills/hook-authoring
Command: npx skills add https://github.com/athola/claude-night-market --skill hook-authoring

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Complete guide for writing Claude Code and SDK hooks with security-first design.

Core Features & Use Cases

  • PreToolUse validation, PostToolUse logging, and UserPromptSubmit hooks
  • Security patterns, performance considerations, and testing guidance
  • Tool validation, context injection, and workflow automation

Quick Start

See JSON hooks in Claude Code and Python SDK hook examples to block dangerous inputs.

Frequently Asked Questions about hook-authoring

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

FAQPage Schema
How do I write secure hooks for Claude Code and the SDK?

Secure hook authoring involves validating inputs, sanitizing secrets, and preventing injection attacks across PreToolUse, PostToolUse, and UserPromptSubmit events. This Skill provides security patterns, validation frameworks, and testing guidance for JSON and Python SDK hooks to block dangerous inputs before code execution.

What hook events can I intercept and automate in Claude Code?

You can intercept PreToolUse, PostToolUse, UserPromptSubmit, Stop, SubagentStop, and PreCompact events to validate tool calls, log outputs, inject context, enforce workflows, and apply security policies at plugin, project, and global scopes.

How do I validate and test hooks for performance and security?

Hook validation requires structured testing of JSON and Python SDK hooks against input validation, anti-injection, and secret sanitization requirements while respecting performance budgets. This Skill covers validation patterns, asynchronous I/O handling, and testing guidance for production-safe hooks.

Can I use hooks to enforce security policies and automate workflows?

Yes. Hooks enable context injection, tool validation, and workflow automation across hook events. You can enforce security policies at multiple scopes—plugin, project, and global—to standardize behavior and block risky operations before execution.

What's the best way to handle secrets and sensitive data in hooks?

Secret sanitization is a core hook pattern covered here. Scrub sensitive data from logs and context using validation rules before passing data downstream, preventing accidental exposure in tool outputs and subagent communication.

Do I need prior hook experience to start writing secure hooks?

No. This Skill provides a complete guide with quick-start examples of JSON hooks and Python SDK patterns that block dangerous inputs, making it accessible to developers new to hook authoring who want security-first design.

Related Skills