tzachbon avatar

Hook Development

Hooks let you intercept Claude Code events to validate operations, block dangerous commands, or inject context at key moments like tool execution or session start. The prompt-based hooks are the standout feature here: instead of writing bash validators, you use natural language to describe what should pass or fail, and an LLM evaluates it. You get PreToolUse for blocking writes to system paths, Stop hooks to ensure tests actually ran before Claude finishes, and SessionStart to load project context. The format distinction between plugin hooks.json (needs a wrapper object) and settings.json (direct event structure) will trip you up once, then you'll remember it. Solid for teams that want guardrails without maintaining brittle shell scripts.

GitHub stars
340
last updated
May 19, 2026

Install

$ npx -y skills add tzachbon/smart-ralph --skill 'Hook Development' --agent claude-code

Installs into .claude/skills of the current project.

Files

Hook Development for Claude Code Plugins

Overview

Hooks are event-driven automation scripts that execute in response to Claude Code events. Use hooks to validate operations, enforce policies, add context, and integrate external tools into workflows.

Key capabilities:

  • Validate tool calls before execution (PreToolUse)
  • React to tool results (PostToolUse)
  • Enforce completion standards (Stop, SubagentStop)
  • Load project context (SessionStart)
  • Automate workflows across the development lifecycle

Hook Types

Prompt-Based Hooks (Recommended)

Use LLM-driven decision making for context-aware validation:

{
  "type": "prompt",
  "prompt": "Evaluate if this tool use is appropriate: $TOOL_INPUT",
  "timeout": 30
}

Supported events: Stop, SubagentStop, UserPromptSubmit, PreToolUse

Benefits:

  • Context-aware decisions based on natural language reasoning
  • Flexible evaluation logic without bash scripting
  • Better edge case handling
  • Easier to maintain and extend

Command Hooks

Execute bash commands for deterministic checks:

{
  "type": "command",
  "command": "bash ${CLAUDE_PLUGIN_ROOT}/scripts/validate.sh",
  "timeout": 60
}

Sponsors

Details

Repository
github.com/tzachbon/smart-ralph
Category
Frontend Development
License
MIT
First seen
Jun 11, 2026

More from tzachbon/smart-ralph

All 28
1udecode avatartestingudecode/better-convexHelps you write React hook tests in Bun without the usual foot-guns.0skills.sh installs
2vamseeachanta avatarorcaflex-model-generatorvamseeachanta/digitalmodelGenerate OrcaFlex models from templates using component assembly with0skills.sh installs
3mindrally avatarnextjs-react-redux-typescript-cursor-rulesmindrally/skillsComprehensive Next.js, React, Redux, and TypeScript development guidelines covering SOLID principles, component architecture, and best practices.868skills.sh installs
4syncfusion avatarsyncfusion-react-dashboard-layoutsyncfusion/react-ui-components-skillsBuild responsive, interactive dashboard layouts with Syncfusion React Dashboard Layout component. Implement draggable and resizable panels, responsive grid syst735skills.sh installs
5giuseppe-trisciuoglio avatartailwind-css-patternsgiuseppe-trisciuoglio/developer-kitProvides comprehensive Tailwind CSS utility-first styling patterns including responsive design, layout utilities, flexbox, grid, spacing, typography, colors, an18Kskills.sh installs
6secondsky avatartailwind-v4-shadcnsecondsky/claude-skills| Production-tested setup for Tailwind CSS v4 with shadcn/ui, Vite, and React. Use when: initializing React projects with Tailwind v4, setting up shadcn/ui, imp8.2Kskills.sh installs