[BUG] Hooks suggestion used a made-up afterEdit event
Resolved 💬 3 comments Opened Mar 3, 2026 by wgillette Closed Mar 7, 2026
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Hooks suggestion used a made-up afterEdit event
# Add to .claude/settings.json:
{
"hooks": {
"afterEdit": {
"command": "cd ~/Projects/recipe-db && python -m py_compile $CLAUDE_EDITED_FILE && echo '✅ Syntax OK' || echo '❌ Syntax error'"
}
}
}
What Should Happen?
the correct Claude Code event is PostToolUse with a matcher for Edit|Write
1 {
2 "hooks": {
3 "PostToolUse": [
4 {
5 "matcher": "Edit|Write",
6 "hooks": [
7 {
8 "type": "command",
9 "command": "FILE=$(jq -r '.tool_input.file_path'); [[ \"$FILE\" == *.py ]] && python -m py_compile \"$FILE\" 2>&1 || true"
10 }
11 ]
12 }
13 ]
14 }
15 }
⎿ 1 PostToolUse hook ran
Error Messages/Logs
Steps to Reproduce
- Create a Python project
- Don't use hooks to check for syntax errors
- Create buggy code
- Run Claude insights
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
Claude Code 2.1.63
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗