This is a reference guide for Claude's hook system, which lets you intercept and modify agent behavior at specific points like before tool execution, after prompts, or during session starts. You write hooks as shell scripts that call TypeScript handlers via tsx, reading JSON input from stdin and outputting whether to continue or block. It's most useful when you need guardrails on what tools Claude can use, want to inject context at session boundaries, or need to log agent actions. The pattern is clean but requires understanding the event lifecycle. If you're building a Claude workflow that needs programmatic control over agent decisions rather than just prompt engineering, this is how you do it.

skills.sh installs
509
GitHub stars
3.9K
last updated
Aug 21, 2026

Install

$ npx -y skills add parcadei/continuous-claude-v3 --skill hooks --agent claude-code

Installs into .claude/skills of the current project.

Files

Hook Development Rules

When working with files in .claude/hooks/:

Pattern

Shell wrapper (.sh) → TypeScript (.ts) via npx tsx

Shell Wrapper Template

#!/bin/bash
set -e
cd "$CLAUDE_PROJECT_DIR/.claude/hooks"
cat | npx tsx <handler>.ts

TypeScript Handler Pattern

interface HookInput {
  // Event-specific fields
}

async function main() {
  const input: HookInput = JSON.parse(await readStdin());

  // Process input

  const output = {
    result: 'continue',  // or 'block'
    message: 'Optional system reminder'
  };

  console.log(JSON.stringify(output));
}

Hook Events

  • PreToolUse - Before tool execution (can block)
  • PostToolUse - After tool execution
  • UserPromptSubmit - Before processing user prompt
  • PreCompact - Before context compaction
  • SessionStart - On session start/resume/compact
  • Stop - When agent finishes

Testing

Test hooks manually:

echo '{"type": "resume"}' | .claude/hooks/session-start-continuity.sh

Sponsors

Details

Repository
github.com/parcadei/continuous-claude-v3
Category
Frontend Development
First seen
Jun 3, 2026

More from parcadei/continuous-claude-v3

All 108
1hyf0 avatarvue-development-guideshyf0/vue-skillsvue development guides501skills.sh installs
2sickn33 avatarnextjs-app-router-patternssickn33/antigravity-awesome-skillsnextjs app router patterns501skills.sh installs
3secondsky avatarfrontend-designsecondsky/claude-skillsCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applicat479skills.sh installs
4manutej avatarangular-developmentmanutej/luxor-claude-marketplaceComprehensive Angular framework development covering components, directives, services, dependency injection, routing, and reactive programming based on official463skills.sh installs
5manutej avatarsvelte-developmentmanutej/luxor-claude-marketplaceComprehensive Svelte development skill covering reactivity runes, components, stores, lifecycle, transitions, and modern Svelte 5 patterns436skills.sh installs
6secondsky avatarnuxt-productionsecondsky/claude-skills| Nuxt 4 production optimization: hydration, performance, testing with Vitest, deployment to Cloudflare/Vercel/Netlify, and v4 migration. Use when: debugging hy425skills.sh installs