/Catalogue/Prompt/parcadei/parcadei-continuous-claude-v3-hooks

Origin: github

hooks

Hook Development Rules

by parcadei · updated 8mo ago · imported from GitHub

Installs0+0/7d
Security score100/100
Retention 14d0%
GitHub stars3.9K

Skill logic

Execution graph
User message
Prompt rewrites behaviour
Response

SKILL.md

View on GitHub ↗

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

Registration

Add hooks to .claude/settings.json:

{
  "hooks": {
    "EventName": [{
      "matcher": ["pattern"],  // Optional
      "hooks": [{
        "type": "command",
        "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/hook.sh"
      }]
    }]
  }
}

Discussion

No comments yet — start the thread.

Sign in to join the discussion.

/More from parcadei/Continuous-Claude-v3

parcadei· 8mo agoCommunity
dead-code

Prompts · Python · v0.1.0

Find unused functions and dead code in the codebase

#agents#claude-code#claude-code-cli

0 3.9K
parcadei· 8mo agoCommunity
agent-orchestration

Prompts · Python · v0.1.0

Agent Orchestration Rules

#agents#claude-code#claude-code-cli

0 3.9K
parcadei· 8mo agoCommunity
agentic-workflow

Prompts · Python · v0.1.0

Agentic Workflow Pattern

#agents#claude-code#claude-code-cli

0 3.9K