Skip to content
secondsky avatar

Claude Hook Writer

Security-first guide for writing, reviewing, and debugging Claude Code hooks, covering event choice, matchers, and exit codes.

CCM score
58 of 100
skills.sh installs
417
GitHub stars
257
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers hook design decisions: which event to target, which tools to match, command versus prompt type, and exit code meaning
  • Includes the top five pitfalls (unquoted variables, unvalidated input, slow blocking hooks, wrong exit codes, missing tools) with fixes
  • Enforces validation of JSON stdin, path traversal checks, and a 100ms target for PreToolUse hooks
  • Designed for developers building, auditing, or troubleshooting Claude Code hooks in shell or prompt form

Install

$ npx -y skills add secondsky/claude-skills --skill claude-hook-writer -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Claude Hook Writer

Status: Production Ready Version: 2.0.0 (Optimized with progressive disclosure) Last Updated: 2025-12-17


Overview

Expert guidance for writing secure, reliable, and performant Claude Code hooks. This skill validates design decisions, enforces best practices, and prevents common pitfalls.


When to Use This Skill

  • Designing a new Claude Code hook
  • Reviewing existing hook code
  • Debugging hook failures
  • Optimizing slow hooks
  • Securing hooks that handle sensitive data
  • Publishing hooks as PRPM packages

Core Principles

1. Security is Non-Negotiable

Hooks execute automatically with user permissions and can read, modify, or delete any file the user can access.

ALWAYS validate and sanitize all input. Hooks receive JSON via stdin—never trust it blindly.

For complete security patterns: Load references/security-requirements.md when implementing validation or securing hooks.

2. Reliability Over Features

A hook that works 99% of the time is a broken hook. Edge cases (Unicode filenames, spaces in paths, missing tools) will happen.

Test with edge cases before deploying.

Details

Repository
github.com/secondsky/claude-skills
Categories
Skill & Plugin Building, CLI & Terminal, Security
First seen
Jun 3, 2026

Questions

What does the claude-hook-writer skill do?

The claude-hook-writer skill gives expert guidance for writing secure, reliable, and performant Claude Code hooks. It checks design decisions, enforces best practices, and helps prevent common pitfalls when creating, reviewing, or debugging hooks.

How do I install the claude-hook-writer skill?

Run npx -y skills add secondsky/claude-skills --skill claude-hook-writer -y in your project. Once installed, the agent can guide you through designing, reviewing, and debugging Claude Code hooks.

Who is the claude-hook-writer skill for?

It is for developers who create, review, or debug Claude Code hooks. The skill covers choosing the right event, matcher, and exit code, validating JSON input, and keeping hooks fast and safe.

Where does claude-hook-writer stand in its category?

It is listed under Skill and Plugin Building on Claude Marketplaces, alongside skills such as find-skills, writing-for-agents, and skill-creator. Its focus is narrower, on writing Claude Code hooks specifically.

More from secondsky/claude-skills

All 116

Similar to Claude Hook Writer

More Skill & Plugin Building