hooks-manager

from adaptationio/skrillz

No description

1 stars0 forksUpdated Jan 16, 2026
npx skills add https://github.com/adaptationio/skrillz --skill hooks-manager

SKILL.md

Hooks Manager

Overview

hooks-manager enables sophisticated workflow automation through Claude Code's hooks system (released June 2025).

Purpose: Create event-driven automation for code formatting, security gates, observability, and validation

Pattern: Task-based (8 operations, one per hook event + management)

Key Innovation: Hooks transform Claude Code from interactive to automated - reducing manual work by up to 92%

Hook Events Available (8):

  1. UserPromptSubmit - Before Claude sees prompts
  2. PreToolUse - Before tool execution
  3. PostToolUse - After tool execution
  4. PermissionRequest - When permissions requested
  5. Notification - Important events
  6. SessionStart - Session initialization
  7. SessionEnd - Session cleanup
  8. Stop - Conversation termination

When to Use

Use hooks-manager when:

  • Auto-formatting code (PostToolUse after Write/Edit)
  • Security gates (PreToolUse to block dangerous operations)
  • Observability integration (send telemetry on all tool calls)
  • Validation enforcement (block invalid operations)
  • Workflow automation (trigger actions on events)
  • Team standardization (enforce coding standards)

Production Impact: Companies report 92% reduction in style review time with PostToolUse formatting hooks


Prerequisites

Required

  • Claude Code (hooks support added June 2025)
  • Basic understanding of event-driven programming

Recommended

  • Linter/formatter installed (ESLint, Prettier, Black)
  • Security tools (if using security hooks)
  • Observability platform (if using telemetry hooks)

Hook Operations

Operation 1: Create Formatting Hook (PostToolUse)

Purpose: Auto-format code after AI writes/edits files

Use Case: Enforce coding standards without manual intervention

Process:

  1. Choose Formatter:

    # JavaScript/TypeScript
    npm install --save-dev prettier
    
    # Python
    pip install black
    
    # Multi-language
    npm install --save-dev prettier @prettier/plugin-python
    
  2. Create Hook Configuration:

    {
      "event": "PostToolUse",
      "tools": ["Write", "Edit"],
      "description": "Auto-format code after Claude writes/edits files",
      "handler": {
        "command": "npx prettier --write \"$FILE\"",
        "timeout": 5000
      },
      "filters": {
        "filePatterns": ["**/*.{ts,tsx,js,jsx,py}"],
        "excludePatterns": ["node_modules/**", "*.min.js"]
      }
    }
    
  3. Install Hook:

    # Global hook (all projects)
    mkdir -p ~/.claude/hooks
    echo '[above-json]' > ~/.claude/hooks/auto-format.json
    
    # Project-specific
    mkdir -p .claude/hooks
    echo '[above-json]' > .claude/hooks/auto-format.json
    
  4. Test Hook:

    # Have Claude write unformatted code
    # Hook should auto-format after Write/Edit
    # Verify formatted correctly
    

Outputs:

  • Hook configuration file
  • Auto-formatting on all code changes
  • 92% reduction in style review time

Validation:

  • Hook file created
  • Formatter configured correctly
  • File patterns appropriate
  • Tested with Claude Code
  • Formatting works automatically

Time Estimate: 30-45 minutes


Operation 2: Create Security Hook (PreToolUse)

Purpose: Block dangerous operations before execution

Use Case: Prevent accidental production file modifications, destructive commands

Process:

  1. Define Security Rules:

    {
      "event": "PreToolUse",
      "tools": ["Write", "Edit", "Bash"],
      "description": "Block dangerous operations",
      "handler": {
        "command": ".claude/hooks/security-check.sh \"$TOOL\" \"$FILE\" \"$COMMAND\""
      },
      "structuredOutput": true
    }
    
  2. Create Security Check Script:

    #!/bin/bash
    # .claude/hooks/security-check.sh
    
    TOOL=$1
    FILE=$2
    COMMAND=$3
    
    # Block production file modifications
    if [[ "$FILE" == "/etc/"* ]] || [[ "$FILE" == "/usr/"* ]]; then
      echo '{"continue": false, "stopReason": "Cannot modify system files", "suppressOutput": true}'
      exit 1
    fi
    
    # Block destructive commands
    if [[ "$COMMAND" =~ rm\ -rf\ / ]] || [[ "$COMMAND" =~ dd\ if ]]; then
      echo '{"continue": false, "stopReason": "Destructive command blocked", "suppressOutput": true}'
      exit 1
    fi
    
    # Block curl/wget (security risk)
    if [[ "$COMMAND" =~ curl|wget ]]; then
      echo '{"continue": false, "stopReason": "Network commands disabled", "suppressOutput": false}'
      exit 1
    fi
    
    # Allow operation
    echo '{"continue": true}'
    exit 0
    
  3. Install Security Hook:

    chmod +x .claude/hooks/security-check.sh
    # Hook JSON already configured in step 1
    

Outputs:

  • Security hook blocking dangerous operations
  • Protection against accidental damage
  • Audit trail of blocked operations

Validation:

  • Hook blocks system file modifications
  • Hook blocks destructive commands
  • Hoo

...

Read full content

Repository Stats

Stars1
Forks0