Claude Code hook system for pre/post tool execution. Triggers on: hooks, PreToolUse, PostToolUse, hook script, tool validation, audit logging.
PostToolUse audit logging hook
Config file location
50%
50%
PostToolUse event
100%
100%
Bash matcher
100%
100%
Command type
100%
100%
Timeout field
0%
100%
stdin read pattern
100%
100%
jq parsing
0%
100%
CLAUDE_PROJECT_DIR usage
100%
100%
Quoted variables
100%
100%
jq error handling
50%
100%
Without context: $0.2125 · 51s · 16 turns · 20 in / 2,633 out tokens
With context: $0.3867 · 1m 15s · 22 turns · 28 in / 4,037 out tokens
PreToolUse blocking hook with security validation
PreToolUse event
100%
100%
Command type and field
100%
100%
stdin read pattern
100%
100%
jq to extract input
0%
100%
Exit code 2 for blocking
100%
100%
Exit code 0 for allowing
100%
100%
Stderr error message
100%
100%
Path traversal check
100%
100%
Quoted variables
100%
100%
jq error handling
0%
100%
Without context: $0.4404 · 1m 46s · 30 turns · 30 in / 6,601 out tokens
With context: $0.4988 · 1m 42s · 26 turns · 717 in / 6,245 out tokens
Session lifecycle hooks (SessionStart and SessionEnd)
Config file location
25%
50%
SessionStart event
0%
100%
SessionEnd event
0%
100%
No matcher on session events
26%
100%
Command type
100%
100%
CLAUDE_PROJECT_DIR in commands
100%
100%
Timeout set
0%
0%
Quoted variables in scripts
100%
100%
Correct array structure
100%
100%
Without context: $0.3000 · 1m 28s · 15 turns · 17 in / 5,375 out tokens
With context: $0.3095 · 1m 2s · 21 turns · 25 in / 3,635 out tokens
5342bca
Table of Contents
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.