Claude Code · Configuration files

Run a command after edits

A hook runs your command automatically at an event, here after Claude edits or writes a file.

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [{ "type": "command", "command": "npm run format" }]
      }
    ]
  }
}

Official Claude Code documentation

More configuration files commands

All configuration files commands · Claude Code cheatsheet

Was this page helpful?