Live data from Hacker News

Claude Code now supports hooks

docs.anthropic.com

1–10 of 184 posts

Re: Claude Code now supports hooks

#2
Really excited to see this implemented.

Hooks will be important for "context engineering" and runtime verification of an agent's performance. This extends to things such as enterprise compliance and oversight of agentic behavior.

Nice of Anthropic to have supported the idea of this feature from a github issue submission: https://github.com/anthropics/claude-code/issues/712

Re: Claude Code now supports hooks

#8

    Exit Code 2 Behavior
    PreToolUse - Blocks the tool call, shows error to Claude
This is great, it means you can set up complex concrete rules about commands CC is allowed to run (and with what arguments), rather than trying to coax these via CLAUDE.md.

E.g. you can allow

    docker compose exec django python manage.py test
but prevent

    docker compose exec django python manage.py makemigrations

Re: Claude Code now supports hooks

#9
post #8

Exit Code 2 Behavior PreToolUse - Blocks the tool call, shows error to Claude This is great, it means you can set up complex concrete rules about commands CC is allowed to run (and with what arguments), rather than trying to coax these via CLAUDE.md. E.g. you can allow docker compose exec django python manage.py test but prevent docker compose exec django python manage.py makemigrations

You can already do this in .Claude/settings.json

Re: Claude Code now supports hooks

#10
This closes a big feature gap. One thing that may not be obvious is that because of the way Claude Code generates commits, regular Git hooks won’t work. (At least, in most configurations.)

We’ve been using CLAUDE.md instructions to tell Claude to auto-format code with the Qlty CLI (https://github.com/qltysh/qlty) but Claude a bit hit and miss in following them. The determinism here is a win.

It looks like the events that can be hooked are somewhat limited to start, and I wonder if they will make it easy to hook Git commit and Git push.

Post reply on HN