claude-hooks (TypeScript)
A TypeScript scaffolding tool for Claude Code hooks by johnlindquist. Run npx claude-hooks to generate .claude/hooks/index.ts with typed PreToolUse, PostToolUse, Notification, and Stop handlers — plus lib.ts type definitions and session.ts utilities. Write hook logic in TypeScript with full IntelliSense; hooks execute via Bun at runtime.
View on GitHubWhat it does
- npx claude-hooks
Scaffold the TypeScript hook system: generates .claude/settings.json, index.ts (handlers), lib.ts (types), and session.ts (tracking utilities).
- PreToolUsePayload typed handler
TypeScript interface for the PreToolUse lifecycle event with typed tool_name and tool_input; return { action: "block" } to reject a tool call.
- PostToolUsePayload typed handler
TypeScript interface for the PostToolUse lifecycle event with typed tool_name, success flag, tool_input, and tool_output.
- npx claude-hooks init --force
Reinitialize the hook scaffolding, overwriting existing generated files.