最終更新:2026-09-08 (火) 09:52:18 (30d)  

Claude Code/フック
Top / Claude Code / フック

https://code.claude.com/docs/ja/hooks-guide

設定

  • ~/.claude/settings.json
    {
      "hooks": {
        "PostToolUse": [
          {
            "matcher": "Edit|Write",
            "hooks": [{ "type": "command", "command": "jq -r '.tool_input.file_path' | xargs npx prettier --write" }]
          }
        ],
        "Notification": [
          {
            "matcher": "",
            "hooks": [{ "type": "command", "command": "osascript -e 'display notification \"Claude Code needs your attention\" with title \"Claude Code\"'" }]
          }
        ]
      }
    }