Hooks

Hooks let Claude Code run shell commands around its lifecycle — before/after edits, on stop, on save. AgentHub ships with hooks.json intentionally empty; opt in by copying from the example file.

Turning on lint-on-edit

Open claude/hooks/hooks.example.json and copy the relevant entries into claude/hooks/hooks.json. Then reload Claude Code.

{
  "hooks": {
    "postEdit": [
      { "matcher": "**/*.{ts,tsx,js,jsx}", "command": "npx eslint --fix $CLAUDE_FILE" }
    ]
  }
}

Generating hooks from natural language

/hub:hookify takes a plain-English description and emits a ready-to-paste snippet. It never writes the hooks file for you — you always paste manually.

/hub:hookify run prettier on every TS file I save, and run vitest after any test file change

Why the file ships empty

Hooks execute shell commands on your machine. We never auto-enable anything that could run arbitrary code without the user opting in explicitly. Every entry in hooks.example.json is there for reference only.

See also