If you're building Claude Code plugins and need to control what happens before and after tool execution, this is your starting point. It covers the five main hook types: PreToolUse for validating operations before they run, PostToolUse for reacting to results, Stop and SubagentStop for enforcing completion standards, and SessionStart for loading project context. The guide emphasizes prompt-based hooks over function-based ones, which makes sense since you get LLM-driven decision making instead of hard-coded logic. Originally from ovachiever/droid-tings, now maintained by davila7. Worth checking out if you're tired of Claude doing things you'd rather it asked about first.

GitHub stars
30.2K
last updated
Aug 21, 2026

Install

$ npx -y skills add davila7/claude-code-templates --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/davila7/claude-code-templates
Categories
Frontend Development, Backend & APIs, AI & Agent Building, Automation & Workflows
First seen
Jun 3, 2026

More from davila7/claude-code-templates

All 618
1dtsola avatarremotion-best-practicesdtsola/xiaoyaosearchBest practices for Remotion - Video creation in React0skills.sh installs
2geekjourneyx avatarai-daily-newsgeekjourneyx/ai-daily-skillFetches AI news from smol.ai RSS and generates structured markdown with intelligent summarization and categorization. Optionally creates beautiful HTML webpages0skills.sh installs
3georgekhananaev avatarsupabase-expertgeorgekhananaev/claude-skills-vaultProduction-grade Supabase expertise for commercial applications. Covers database design, RLS policies, authentication (SSO/SAML, MFA, SSR), Edge Functions, Real0skills.sh installs
4ghostsecurity avatarghost-scan-codeghostsecurity/skillsGhost Security - SAST code scanner. Finds security vulnerabilities in source code by planning and executing targeted scans for issues like SQL injection, XSS, B0skills.sh installs
5hoangnguyen0403 avatarpentesthoangnguyen0403/agent-skills-standardPTES-aligned adversarial security audit for backend, frontend, and mobile applications. Produces a CVSS-scored Hacker Report with verified PoCs and phased remed0skills.sh installs
6hoangsonww avatardebug-live-issuehoangsonww/claude-code-agent-monitorDebug production-like issues in this repository with disciplined evidence gathering. Use when fixing failing workflows, regressions, flaky behavior, or data inc0skills.sh installs