claude-hook-writer

Review Claude Code hooks for security vulnerabilities and reliability issues.

121|16|Updated Oct 10, 2025
One-click install
npx skills add https://github.com/pr-pm/prpm --skill claude-hook-writer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: claude-hook-writer
Source: https://github.com/pr-pm/prpm/tree/main/.claude/skills/claude-hook-writer
Command: npx skills add https://github.com/pr-pm/prpm --skill claude-hook-writer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires jq.

What problem does it solve?

This Skill prevents security vulnerabilities, reliability issues, and performance problems in Claude Code hooks by providing comprehensive best practices and validation.

Core Features & Use Cases

  • Security Validation: Ensures hooks properly validate input, sanitize paths, and protect sensitive files.
  • Design Guidance: Helps choose the right hook type, matchers, and exit codes for specific use cases.
  • Use Case: When creating a new hook to automatically format code on save, use this Skill to ensure it handles edge cases, validates file paths, and doesn't block Claude operations.

Quick Start

Use the claude-hook-writer skill to review my current hook script and identify any security vulnerabilities or reliability issues.

Frequently Asked Questions about claude-hook-writer

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

FAQPage Schema
How do I write secure Claude Code hooks that validate input and sanitize paths?

Secure Claude Code hooks require input validation, path sanitization, and protection of sensitive files. Apply defensive coding practices including explicit exit codes, robust error handling, and validation of all user-supplied data before processing to prevent vulnerabilities and ensure reliable hook execution.

What are the best practices for designing and reviewing Claude Code hooks?

Hook design requires choosing the correct hook type and matchers for your use case, then validating that the hook handles edge cases, protects sensitive files, and doesn't block Claude operations. Review hooks for input validation, path handling, error codes, and performance impact before deployment.

Can I use Claude Code hooks for automation tasks like formatting code on save?

Yes, Claude Code hooks automate tasks like code formatting on save, but must validate file paths, handle edge cases, and avoid blocking operations. Apply security validation and reliability checks to prevent vulnerabilities and ensure the hook performs consistently without disrupting Claude workflows.

How do I identify and fix security vulnerabilities in my existing Claude Code hooks?

Review hooks for input validation gaps, unsanitized paths, unprotected sensitive files, inadequate error handling, and missing exit codes. Apply defensive coding practices and explicit validation logic to harden hooks against injection attacks, path traversal, and file access violations.

What are common reliability issues in Claude Code hooks and how do I avoid them?

Common issues include missing input validation, improper path handling, inadequate error handling, and unclear exit codes. Ensure hooks validate all inputs, sanitize file paths, protect sensitive files, handle errors robustly, and use explicit exit codes to communicate success and failure states.