←back to thread

Claude Code now supports hooks

(docs.anthropic.com)
381 points ramoz | 1 comments | | HN request time: 0.201s | source
Show context
nojs ◴[] No.44429415[source]

    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
replies(1): >>44429449 #
rco8786 ◴[] No.44429449[source]
You can already do this in .Claude/settings.json
replies(2): >>44429539 #>>44435827 #
1. paulhodge ◴[] No.44435827[source]
That's limited to simple string matching with `*` so it can't handle anything complex.