skills/claude-code-hooks/SKILL.md
Claude Code hook system for pre/post tool execution. Triggers on: hooks, PreToolUse, PostToolUse, hook script, tool validation, audit logging.
npx skillsauth add 0xDarkMatter/claude-mods claude-code-hooksInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Execute custom scripts before/after Claude Code tool invocations.
| Event | When | Has Matcher |
|-------|------|-------------|
| PreToolUse | Before tool execution | Yes |
| PostToolUse | After tool completes | Yes |
| PermissionRequest | Permission dialog shown | Yes |
| Notification | Notifications sent | Yes |
| UserPromptSubmit | User submits prompt | No |
| Stop | Agent finishes | No |
| SubagentStop | Subagent finishes | No |
| PreCompact | Before context compaction | No |
| SessionStart | Session begins/resumes | No |
| SessionEnd | Session ends | No |
Add to ~/.claude/settings.json or .claude/settings.local.json:
{
"hooks": {
"PreToolUse": [{
"matcher": "Bash",
"hooks": [{
"type": "command",
"command": "$CLAUDE_PROJECT_DIR/hooks/validate.sh",
"timeout": 5000
}]
}]
}
}
| Pattern | Matches |
|---------|---------|
| "Write" | Only Write tool |
| "*" or "" | All tools |
| "mcp__*" | All MCP tools |
| "Bash" | Bash commands |
#!/bin/bash
# Receives JSON via stdin: { "tool_name": "...", "tool_input": {...} }
INPUT=$(cat)
TOOL=$(echo "$INPUT" | jq -r '.tool_name')
# Exit codes:
# 0 = Success (continue)
# 2 = Block with error (stderr shown to Claude)
# Other = Non-blocking error
| Use Case | Event | Example | |----------|-------|---------| | Validate inputs | PreToolUse | Block dangerous commands | | Audit logging | PostToolUse | Log all tool usage | | Custom approval | PermissionRequest | Slack notification | | Session init | SessionStart | Load project context |
"$VAR" not $VAR.. traversal)$CLAUDE_PROJECT_DIR for paths# Debug hook loading
claude --debug
# List registered hooks
/hooks
# Test script manually
echo '{"tool_name":"Bash"}' | ./hooks/validate.sh
./references/hook-events.md - All events with input/output schemas./references/configuration.md - Advanced config patterns./references/security-ops.md - Production securitySee Also: claude-code-debug for troubleshooting, claude-code-headless for CLI automation
testing
Audit any repo against the agentic-quality doctrine — score entry docs, structure, and enforcement gates, then map each finding to its fix. Triggers on: repo doctor, repo audit, agentic quality, is this repo agent-friendly, doc drift, stale AGENTS.md, monorepo structure, nested CLAUDE.md.
data-ai
Router for parallel or recurring agent work across six skills. Covers: parallel agents, fan out work, delegate to workers, run overnight, scheduled loop, land branches, mixed-model fleet, orchestrate workers, background agents at scale. Triggers on: which skill for parallel work, fan out agents, spawn workers, run this overnight, schedule a loop, land my branches, heterogeneous fleet, delegate to cheaper model, autonomous loop.
tools
Heterogeneous cross-provider fleet - GLM (z.ai), Codex (OpenAI), Grok (xAI), Anthropic Sonnet/Opus/Haiku - from one session, porting the native Workflow tool's patterns (adversarial verify, judge panels, journal resume) to OS-process workers. Triggers: fleetflow, heterogeneous/mixed-model fleet, codex worker, grok worker, cross-provider fan-out, cross-model verify.
development
Application/game-scale three.js: ES modules, GLTF pipeline (DRACO/KTX2/meshopt), AnimationMixer, physics (rapier/cannon-es), react-three-fiber, and performance at scale (InstancedMesh, LOD, draw calls). Triggers on: three.js, GLTFLoader, r3f, game loop, WebGL memory leak, boids.