←back to thread

Claude Code now supports hooks

(docs.anthropic.com)
381 points ramoz | 5 comments | | HN request time: 0.411s | source
1. jonstewart ◴[] No.44429973[source]
I've been playing with Claude Code the past few days. It is very energetic and maybe will help me get over the hump on some long-standing difficult problems, but it loses focus quickly. Despite explicit directions in CLAUDE.md to build with "make -j8" and run unit tests with "make -j8 check", I see it sometimes running make without -j or calling the test executable directly. I would like to limit it to doing certain essential aspects of workflow with the commands I specify, just as a developer would normally do. Are "Hooks" the right answer?
replies(2): >>44429993 #>>44435956 #
2. bfLives ◴[] No.44429993[source]
For the `-j` issue specifically, exporting `MAKEFLAGS=-j8` should work.
replies(2): >>44431140 #>>44431418 #
3. wahnfrieden ◴[] No.44431140[source]
or mcp
4. kaoD ◴[] No.44431418[source]
Thanks, I'll let Claude know.
5. paulhodge ◴[] No.44435956[source]
The AI definitely gets confused when there is a lot of stuff happening. It helps if you try to make the commands as easy as possible. Like, change 'make' so that '-j8' is default, or add scripts like make-check.sh that does 'make -j check', or add an MCP server that has commands for the most common actions (tell the AI to write an MCP server for you).

Hooks would probably help, I think you could add a hook to auto-reject the bot when it calls the wrong thing.