Sponsor Suno AI Music arrow_forward
Slash Command

Validate Hook

Validate hooks for security, performance, and SDK compliance

Type
Slash Command
GitHub stars
339
License
MIT
Repo last updated
Sep 24, 2026

What Validate Hook is

Validate Hook is a slash command published in the athola/claude-night-market repository on GitHub, which has about 339 stars. The repository describes itself as: “23 Claude Code plugins: TDD enforcement hooks, git/PR workflows, spec-driven development, code review, project lifecycle, fix-from-error, maintenance automation, context optimization, research, and multi-LLM delegation. 186 skills, 128 commands, 54 agents.”

A slash command is a reusable prompt saved as a markdown file and run by typing its name after a slash. In Claude Code, custom commands have been merged into skills: a file in .claude/commands/ and a skill folder in .claude/skills/ both create the same kind of command, and existing command files keep working.

Validate Hook gives you a repeatable way to run the same instructions without retyping them, optionally with arguments.

How to install Validate Hook

Claude Code

  1. Download validate-hook.md from the repository.
  2. Save it to ~/.claude/commands/ (all projects) or .claude/commands/ (one project). As a skill, you can instead save it as ~/.claude/skills/<name>/SKILL.md.
  3. Run it by typing / followed by its name.

Claude Cowork

  1. Turn the command into a skill: create a folder with the file saved as SKILL.md and zip it.
  2. In Customize → Skills, click +, then upload the ZIP.
  3. Run it from any task with / and the skill name.

New to extending Cowork? Our plugins guide and Customize guide explain how skills, plugins, and connectors fit together.

Inside the source file

An excerpt from plugins/abstract/commands/validate-hook.md, shared under the repository's MIT license. Read the full file on GitHub.

Detailed validation for Claude Code and SDK hooks. Performs security scanning, performance analysis, and compliance verification.

When To Use

Use this command when you need to:

  • Developing hooks and need validation before deployment
  • Auditing existing hooks for security vulnerabilities
  • Checking hook performance and timeout compliance
  • Verifying compliance with SDK best practices
  • Before committing hook changes

When NOT To Use

Avoid this command if:

  • Creating new hooks - use /create-hook instead
  • Evaluating all hooks in plugin - use /hooks-eval instead
  • Deciding hook placement - use hook-scope-guide skill

Usage

# Validate all aspects (default)
/validate-hook hooks/my-hook.py

# Validate specific aspects
/validate-hook hooks/my-hook.py --security
/validate-hook hooks/my-hook.py --performance
/validate-hook hooks/my-hook.py --compliance

# Validate all hooks in directory
/validate-hook hooks/ --all

# Generate detailed report
/validate-hook hooks/my-hook.py --report

# Auto-fix issues where possible
/validate-hook hooks/my-hook.py --fix

Validation Categories

Security Scan (--security)

Checks for security vulnerabilities and unsafe patterns:

  • Input Validation: Type checking, size bounds, sanitization
  • Command Injection: Shell command safety, parameter escaping, code injection patterns
  • Path Traversal: Path validation, directory restrictions, directory traversal attacks
  • Data Leakage: PII handling, credential exposure, hardcoded secrets
  • Privilege Escalation: Permission checks, sandboxing, sudo usage, chmod operations
  • Crypto Issues: Weak encryption, insecure randomness

Score: PASS (100%), WARN (80-99%), FAIL (<80%)

Performance Check (--performance)

Analyzes hook efficiency and resource usage:

  • Timeout Compliance: Execution within limits (1-10s typical)
  • Resource Usage: Memory, CPU, file handles
  • Blocking Operations: Async patterns, non-blocking I/O
  • Caching: Result caching, expensive operation optimization
  • Early Exits: Fast-path optimization
  • Scalability: Performance under load, large file handling
  • Pattern Matching Efficiency: Regex compilation, loop optimization

Score: OPTIMAL (>90%), ACCEPTABLE (70-90%), POOR (<70%)

Compliance Check (--compliance)

Verifies SDK and best practice adherence:

  • SDK Version: Compatible with installed version
  • Hook Schema: Correct frontmatter, required fields
  • Output Format: Valid JSON structure
  • Error Handling: Try-catch blocks, graceful failures, proper exit codes
  • Logging: Structured logging, appropriate levels
  • Scope Appropriateness: Correct hook placement and precedence (plugin/project/global)
  • Variable Quoting: Shell variable safety, set operations

Score: COMPLIANT (100%), MINOR ISSUES (95-99%), NON-COMPLIANT (<95%)

Combined Report

VALIDATION REPORT: hooks/pre-tool-use.py
==========================================
SECURITY:     PASS (100%) - No issues found
PERFORMANCE:  WARN (85%)  - Consider async for file I/O
COMPLIANCE:   PASS (100%) - Fully compliant

OVERALL: PASS with 1 warning

Issues Found:
[PERFORMANCE/WARN] Line 45: Synchronous file read
  Impact: May block execution for large files
  Fix: Use async file I/O or implement timeout

Recommendations:
- Consider adding result caching for expensive operations
- Add unit tests for error paths

Exit Codes

  • 0: PASS - Hook validated successfully
  • 1: WARN - Issues found, review recommended
  • 2: FAIL - Critical issues, must fix before deployment

Auto-Fix Mode

/validate-hook hooks/my-hook.py --fix

Automatically applies fixes for common issues:

  • Add missing input validation
  • Implement timeout guards
  • Fix JSON output structure
  • Add error handling wrappers

Note: Review auto-fixes before committing.

Detailed Validation Guides

For more validation patterns, see the validate-hook source code and examples in the abstract validation framework.

Best Practices

When to Validate:

  • Before every hook commit
  • After modifying hook logic
  • Before production deployment
  • During security audits
  • After SDK updates

Score Interpretation:

  • 100%: Production ready
  • 95-99%: Minor improvements recommended
  • 80-94%: Review and fix warnings
  • <80%: Critical issues, must fix

Common Patterns:

  • Validate inputs at entry points
  • Use timeouts for all external operations
  • Implement graceful error handling
  • Cache expensive computations
  • Log security-relevant events

Before you install

  • Read the whole file first. Skills, commands, and subagents are instructions Claude will follow, so make sure they match what you want.
  • Check which tools, scripts, or MCP servers it uses. Local servers and scripts run with your permissions.
  • Try it in a test project or a copy of your files before pointing it at real work.
  • Pin the version you tested, and review changes before updating.
  • Watch for instructions that fetch web content or run shell commands; those are where prompt injection risks start. See our prompt injection guide.

FAQ

What is Validate Hook?

Validate Hook is a slash command for Claude Code and Claude Cowork from the athola/claude-night-market repository on GitHub. Validate hooks for security, performance, and SDK compliance

How do I install Validate Hook in Claude Code?

Download validate-hook.md from the repository. Save it to ~/.claude/commands/ (all projects) or .claude/commands/ (one project). As a skill, you can instead save it as ~/.claude/skills/<name>/SKILL.md. Run it by typing / followed by its name.

Can I use Validate Hook in Claude Cowork?

Turn the command into a skill: create a folder with the file saved as SKILL.md and zip it. In Customize → Skills, click +, then upload the ZIP. Run it from any task with / and the skill name.

Is Validate Hook safe to install?

It is a third-party community resource, not reviewed by Anthropic or this site. Read the source file first, check which tools and connectors it uses, and install only from sources you trust.

Similar resources

Browse all skills, subagents, and plugins →

Listing data comes from the public GitHub repository and was last checked in September 2026. Excerpts are © their authors and shared under MIT. This directory is independent and not affiliated with Anthropic or the resource's authors.