claude-world

hook-template

8
2
# Install this skill:
npx skills add claude-world/director-mode-lite --skill "hook-template"

Install specific skill from multi-skill repository

# Description

Generate hook script from template

# SKILL.md


name: hook-template
description: Generate hook script from template
user-invocable: true


Hook Template Generator

Generate a hook script and configuration based on requirements.

Usage: /hook-template [hook-type] [purpose]


Hook Types

Type When it Runs Use Case
PreToolUse Before tool Block, validate
PostToolUse After tool Log, notify
Stop When stopping Continue loops
Notification On alerts External notify

Process

  1. Gather Requirements
  2. Hook type
  3. Purpose
  4. Matcher (for Pre/PostToolUse)

  5. Generate Script at .claude/hooks/[name].sh

  6. Update settings.json with hook config

  7. Make Executable: chmod +x

  8. Validate with /hooks-check


Templates

PreToolUse (Blocker)

#!/bin/bash
INPUT=$(cat)
TOOL=$(echo "$INPUT" | jq -r '.tool_name')
# Your logic
echo '{"decision": "allow"}'

Stop (Auto-Loop)

#!/bin/bash
CHECKPOINT=".auto-loop/checkpoint.json"
if [[ ! -f "$CHECKPOINT" ]]; then
  echo '{"decision": "allow"}'
  exit 0
fi
# Continue logic

Example

/hook-template PreToolUse "block edits to package-lock.json"

Creates:
- .claude/hooks/protect-lockfile.sh
- Updates .claude/settings.json

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.