开始使用免费开始使用

Understanding Hooks

This hook is configured in .claude/settings.json for the Music Analytics API project. It uses a PostToolUse trigger with a matcher and runs a shell command when the condition is met.

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write|Edit",
        "hooks": [
          {
            "type": "command",
            "command": "echo 'file modified' >> hook.log"
          }
        ]
      }
    ]
  }
}

Given this hook configuration, what will trigger it?

本练习是课程的一部分

Software Development with Claude Code

查看课程

动手互动练习

通过我们的互动练习之一,将理论转化为实践

开始练习