PostToolUse Hook (auto-format / lint)
Claude Code / 에이전트파일 수정 후 자동 실행되는 훅 설정
언제 쓰나 · Edit/Write 후 포맷·린트를 자동화할 때
#hook#automation#settings
Add a PostToolUse hook in `.claude/settings.json` that runs after edits.
```json
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [{ "type": "command", "command": "{{command}}" }]
}
]
}
}
```
Set `{{command}}` to your formatter/linter (e.g. `npx prettier --write "$CLAUDE_FILE_PATHS"`).
The hook's stdout/stderr is fed back to the model as feedback — make failures loud and actionable.jt · v1 · CC0-1.0 · 복사 0