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