Хуки для Claude Code: перехват событий и вызовов
engineering
hooks is a Claude Code skill that defines rules for building hooks: shell-wrapper patterns, TypeScript handlers, and registration in `.claude/settings.json`. The architecture follows a single chain: a `.sh` wrapper invokes a TypeScript file via `npx tsx`, piping a JSON event through stdin. The handler parses the input and returns an object with a `result` field (`continue` or `block`) and an optional `message`. Six hook events are covered — PreToolUse, PostToolUse, UserPromptSubmit, PreCompact, SessionStart, and Stop — along with a manual testing approach using `echo '{...}' | .claude/hooks/script.sh`. Ideal for developers who need to intercept tool calls, enforce policies, or react to session lifecycle events in Claude Code.
- #hooks
- #claude-code
- #shell-typescript
- #registration
- #testing