スキル一覧に戻る
teren-papercutlabs

hook-creator

by teren-papercutlabs

0🍴 0📅 2026年1月15日
GitHubで見るManusで実行

SKILL.md


name: hook-creator description: Help me create a Claude Code hook. Interviews about what to catch, then generates PreToolUse or PostToolUse hook.

Hook Creator

Use the interview skill protocol to understand what guardrail they want, then create the hook.

Questions to Ask

  1. "What do you want to catch or check?"

    • Get the core concern
  2. "Describe a scenario where this should fire."

    • Helps determine Pre vs Post
  3. "What should happen when it fires?"

    • Block, warn, remind, validate

Pre vs Post Heuristic

Based on their answers, determine:

PreToolUse (fires BEFORE action):

  • Catch wrong approach before it happens
  • "Don't do X directly, do Y instead"
  • "Pause and consider before acting"
  • Can BLOCK the action

PostToolUse (fires AFTER action):

  • Validate output (lint-like)
  • "Check the result follows pattern X"
  • Deterministic checks on what was written
  • Cannot block (already happened), but can warn

Tool Matching

Common patterns:

  • Bash with db:migrate - catches migration runs
  • Edit with app/models/ - catches model edits
  • Write with db/migrate/ - catches migration file creation
  • Bash with rm or delete - catches destructive commands

After the Interview

Create:

1. Hook Script

Create .claude/hooks/<hook-name>.sh (or .py):

#!/bin/bash
# Hook: <name>
# Fires: <Pre|Post>ToolUse on <tool>

echo "Reminder: <message>"
exit 0

For blocking hooks, exit non-zero:

echo "Blocked: <reason>"
exit 1

2. Settings Entry

Add to .claude/settings.json:

{
  "hooks": {
    "<Pre|Post>ToolUse": [
      {
        "matcher": {
          "tool": "<Bash|Edit|Write>",
          "<command|file_path>": "<pattern>"
        },
        "hooks": [
          {
            "type": "command",
            "command": ".claude/hooks/<hook-name>.sh"
          }
        ]
      }
    ]
  }
}

Matcher Patterns

  • command: regex match on Bash command (e.g., "db:migrate")
  • file_path: glob match on file path (e.g., "app/models/**")

Example Hooks

Pre-migrate reminder:

{
  "matcher": { "tool": "Bash", "command": "db:migrate" },
  "hooks": [{ "type": "command", "command": "echo 'Did you review the migration?'" }]
}

Post-model edit lint:

{
  "matcher": { "tool": "Edit", "file_path": "app/models/**" },
  "hooks": [{ "type": "command", "command": ".claude/hooks/check-model.sh" }]
}

スコア

総合スコア

50/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です