secondsky avatar

Claude Hook Writer

If you're writing Claude Code hooks, this walks you through the entire lifecycle from design decisions to deployment. It's structured around progressive disclosure, loading detailed references only when you need them, which reportedly cuts token usage by 55%. The core content focuses on five specific pitfalls that break hooks in production: unquoted variables failing on filenames with spaces, missing input validation enabling path traversal, synchronous operations blocking Claude for 30+ seconds, using exit 1 instead of exit 2 so PreToolUse hooks don't actually block, and assuming dependencies exist. Good for both writing new hooks and debugging why existing ones fail intermittently.

skills.sh installs
408
GitHub stars
248
last updated
Aug 21, 2026

Install

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

Installs into .claude/skills of the current project.

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.

Sponsors

Details

Repository
github.com/secondsky/claude-skills
Categories
Frontend Development, Documentation, Debugging, Design & UI/UX
First seen
Jun 3, 2026

More from secondsky/claude-skills

All 146
1mindfold-ai avatartrellis-metamindfold-ai/trellisUnderstand and customize the local Trellis architecture inside a user project. Use when modifying .trellis plus platform hooks, settings, agents, skills, comman405skills.sh installs
2aidenwu0209 avatarpaddleocr-doc-parsingaidenwu0209/paddleocr-skillsUse this skill to extract structured Markdown/JSON from PDFs and document images—tables with cell-level precision, formulas as LaTeX, figures, seals, charts, he404skills.sh installs
3fredm00n avatarframer-code-components-overridesfredm00n/framerlabsCreate Framer Code Components and Code Overrides. Use when building custom React components for Framer, writing Code Overrides (HOCs) to modify canvas elements,404skills.sh installs
4joneqian avatartdesign-miniprogramjoneqian/claude-skills-suiteTDesign Mini Program UI component library by Tencent. Use for building WeChat mini apps with TDesign components, design system, and best practices.403skills.sh installs
5tartinerlabs avatarsetuptartinerlabs/skillsUse when setting up a project, adding linting, formatting, git hooks, or type checking. Detects the language and installs that ecosystem's lint/format/hooks too400skills.sh installs
6chouheiwa avatarwechat-studiochouheiwa/wechat-studio微信公众号内容创作全流程工具,支持 Markdown 主题排版、Dan Koe 风格写作、AI 去痕、图片上传、图文草稿和小绿书发布。Use this skill when the user asks about WeChat Official Account publishing, converting Markdo397skills.sh installs