Skip to content

Shell-to-TypeScript hook pattern with templates, six lifecycle events, and settings registration for Claude Code.

CCM score
48 of 100
skills.sh installs
511
GitHub stars
4K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers the shell wrapper and TypeScript handler pattern for files in .claude/hooks/, with templates for both
  • Lists six hook events: PreToolUse, PostToolUse, UserPromptSubmit, PreCompact, SessionStart, and Stop
  • Shows how to test a hook manually by piping JSON into its shell wrapper
  • Explains how to register hooks with matchers and commands in .claude/settings.json

Install

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

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

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

Details

Repository
github.com/parcadei/continuous-claude-v3
Categories
Skill & Plugin Building, CLI & Terminal
First seen
Jun 3, 2026

More from parcadei/continuous-claude-v3

All 108