hooks-test

Validate Claude Code hooks with unit, direct invocation, and headless tests.

1|Updated Jan 12, 2026
One-click install
npx skills add https://github.com/srnnkls/tropos --skill hooks-test-srnnkls
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hooks-test
Source: https://github.com/srnnkls/tropos/tree/main/skills/hooks-test
Command: npx skills add https://github.com/srnnkls/tropos --skill hooks-test-srnnkls

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides a structured, safe framework to validate Claude Code hook behavior across unit tests, direct invocation, and headless end-to-end workflows.

Core Features & Use Cases

  • Unit tests (Python) for hook logic using a test harness
  • Direct invocation tests with JSON payloads to exercise hooks
  • Headless Claude end-to-end testing to verify real-world interactions

Quick Start

Run the provided test harness to simulate hook interactions and verify behavior.

Frequently Asked Questions about hooks-test

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

FAQPage Schema
How do I test Claude Code hooks in isolation?

To test Claude Code hooks in isolation, you can use a structured unit test harness to validate hook logic, run direct invocations with JSON payloads, and execute headless end-to-end tests.

What is the best way to validate PreToolUse and PostToolUse hook behavior?

Validating PreToolUse and PostToolUse hook behavior is best achieved by running a test harness that supports unit tests, direct invocation, and headless end-to-end testing workflows across these specific contexts.

Can I run unit tests for Claude Code hooks using pytest?

Yes, you can run unit tests for Claude Code hooks using pytest, as the testing framework provides pytest templates within its unit test harness to validate hook logic.

How do I debug Claude Code hooks with direct invocation?

To debug Claude Code hooks with direct invocation, you execute the hooks by passing JSON payloads directly to exercise their logic and verify their behavior outside the live application.

Does this testing framework support headless end-to-end testing for hooks?

Yes, the testing framework supports headless Claude end-to-end testing to verify real-world interactions and validate hook behavior across PreToolUse, PostToolUse, and UserPromptSubmit contexts.

Why do I need payload schemas for testing Claude Code hooks?

You need payload schemas for testing Claude Code hooks to accurately simulate and validate hook events, ensuring your direct invocation and unit tests correctly process the expected JSON data structures.