hook-writer

Generate Python templates for Claude Code hooks with valid JSON schemas.

31|6|Updated Dec 13, 2025
One-click install
npx skills add https://github.com/WaterplanAI/agentic-config --skill hook-writer-waterplanai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hook-writer
Source: https://github.com/WaterplanAI/agentic-config/tree/main/core/skills/hook-writer
Command: npx skills add https://github.com/WaterplanAI/agentic-config --skill hook-writer-waterplanai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers writing Claude Code hooks must manually craft Python templates, ensure they output the correct JSON hook schema, and implement a fail-open safety pattern. This Skill streamlines that work by providing ready-to-run hook templates and clear guidance.

Core Features & Use Cases

  • PreToolUse, PostToolUse, and UserPromptSubmit hook templates that produce a valid JSON structure.
  • Type-safe Python TypedDict templates and a complete hook template ready for integration across projects.
  • Use Case: A software team standardizes Claude Code hook handling to prevent dangerous commands, log outcomes, and transform user prompts before tool execution.

Quick Start

Create a new Claude Code hook template using this Skill to generate a Python hook script that validates outputs and applies the fail-open policy.

Frequently Asked Questions about hook-writer

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

FAQPage Schema
How do I generate Python hook templates for Claude Code?

Hook-writer automates Python template generation for Claude Code hooks, producing valid JSON schemas for PreToolUse, PostToolUse, and UserPromptSubmit handlers. It provides ready-to-run templates with TypedDict type safety and fail-open validation built in, eliminating manual schema crafting and runtime errors.

What is a fail-open pattern and why does it matter for hooks?

A fail-open pattern ensures hooks allow execution to proceed safely if validation fails, preventing hook errors from blocking Claude Code workflows. Hook-writer enforces this pattern by design, guaranteeing your hooks won't crash your integration even if edge cases occur.

Can I use hook-writer to validate JSON output from my hooks?

Yes. Hook-writer generates templates that validate input and output structures against JSON schemas, catching mismatches before runtime. This prevents invalid hook responses from reaching Claude Code and causing workflow failures.

How do I standardize hook handling across multiple Claude Code projects?

Hook-writer produces complete, type-safe Python hook templates you can reuse across projects. The generated TypedDict templates and standardized structure ensure consistent PreToolUse, PostToolUse, and UserPromptSubmit behavior without rewriting hooks for each integration.

Do I need to write hook schemas manually or does hook-writer handle them?

Hook-writer handles schema generation. It produces Python templates that output correct JSON hook structures automatically, eliminating manual schema writing and the errors that come with it.