nyosegawa

Claude Hook Experiment — Development skill for Claude Code

Development community

Reproducible Claude Code hook experiments for validating settings-based hook behavior.

How to install Claude Hook Experiment

This entry records only its repository, not the path inside it, so there is no exact command to give. Open nyosegawa/claude-hook-experiment and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Claude Hook Experiment does

Reproducible Claude Code hook experiments for validating settings-based hook behavior.

Alternatives in Development

  • Jupyter Notebook — Create clean, reproducible Jupyter notebooks for experiments and tutorials 14.6k ★
  • Validate Plan — You are tasked with validating that an implementation plan was correctly executed, verifying all success crite 10k ★
  • Prioritize Assumptions — Prioritize assumptions with Impact × Risk matrix and experiments 7.8k ★

README

claude-hook-experiment

Reproducible Claude Code hook experiments.

Snapshot

Included snapshot:

  • Claude Code 2.1.72
  • OS Darwin 25.3.0

Observed in the included runs:

  • settings-based PreToolUse, Stop, and SubagentStop worked in the tested cases
  • plain stdout from PostToolUse did not appear as model-visible lint feedback
  • hookSpecificOutput.additionalContext was observed in -p and in the checked true TTY interactive case
  • the tested plugin_dir settings-hook cases worked
  • frontmatter Stop was not observed on the tested plugin-backed subagent path

Raw snapshots are stored in `results/`.

Layout

  • config/settings.local.json: shared settings-based hook fixture
  • scripts/: experiment runners
  • results/: saved JSONL snapshots from 2026-03-11
  • cases/: minimal truth-case fixtures
  • logs/: selected TTY logs

Requirements

  • Claude Code CLI (claude)
  • jq
  • bash

Quick Start

For a manual smoke test:

./scripts/quick_test.sh

This prints a 3-case manual check and creates a small fixture under the system temp directory.

Re-run the automated matrix

Baseline matrix:

./scripts/run_auto_tests.sh

Default outputs:

  • ${TMPDIR:-/tmp}/claude-hook-experiment/auto_cases/
  • ${TMPDIR:-/tmp}/claude-hook-experiment/auto_results.generated.jsonl

Focused matrix:

CLAUDE_MODEL=sonnet ./scripts/run_focus_tests.sh

Default outputs:

  • ${TMPDIR:-/tmp}/claude-hook-experiment/focus_cases/
  • ${TMPDIR:-/tmp}/claude-hook-experiment/focus_results.generated.jsonl

Compare against the saved snapshots:

diff -u results/auto_results.jsonl "${TMPDIR:-/tmp}/claude-hook-experiment/auto_results.generated.jsonl"
diff -u results/focus_results.jsonl "${TMPDIR:-/tmp}/claude-hook-experiment/focus_results.generated.jsonl"

Manual truth cases

These fixtures were used to check stdout vs `additionalContext`, and local vs plugin-backed frontmatter `Stop`.

  • cases/tty_truth_post_stdout_sonnet