Insights suggests incorrect hook syntax

Resolved 💬 2 comments Opened Feb 18, 2026 by tom-pang Closed Mar 19, 2026

Problem

The insights report "Features to Try" section suggests adding hooks with incorrect syntax:

{
  "hooks": {
    "afterEdit": [
      {
        "match": "*.go",
        "command": "gofmt -w $CLAUDE_FILE"
      }
    ]
  }
}

This is wrong in multiple ways:

  • afterEdit is not a valid hook event name (should be PostToolUse with tool matcher)
  • match is not a valid field (should be pattern for file matching within a matcher)
  • $CLAUDE_FILE is not a real environment variable in the hook system (edited file path is available via $CLAUDE_TOOL_USE_INPUT)

The correct syntax for an "auto-format Go files after edit" hook looks quite different from what's suggested. Suggesting broken config that users will paste and then have to debug is worse than not suggesting it at all.

Expected behavior

If insights suggests hook configurations, they should use the correct schema and field names from the actual hooks documentation.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗