Claude Hook Kit — Development skill for Claude Code
TypeScript SDK for building Claude Code hooks — typed, testable, composable.
How to install Claude Hook Kit
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open Payshak/claude-hook-kit and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Claude Hook Kit does
TypeScript SDK for building Claude Code hooks — typed, testable, composable.
Alternatives in Development
- Open Agent SDK TypeScript — Agent-SDK without CLI dependencies, as an alternative to claude-agent-sdk, completely open source 2.6k ★
- Acp Go SDK — Go SDK for the Agent Client Protocol (ACP), offering typed requests, responses, and helpers so Go applications 226 ★
- Claude Code TypeScript Hooks — Fast, intelligent quality checks for different project types 172 ★
README
claude-hook-kit
TypeScript SDK for building [Claude Code](https://docs.anthropic.com/en/docs/claude-code) hooks — typed, testable, composable.
Claude Code's hook system lets you intercept tool calls, inject context, and react to session events. Without this package, hooks are raw shell scripts that read/write JSON with no type safety, no testing utilities, and no shared patterns. `claude-hook-kit` fixes that.
import { defineHook, block, allow } from 'claude-hook-kit'
defineHook<'PreToolUse'>(async (event) => {
if (event.tool_name === 'Bash') {
const { command } = event.tool_input
if (command.includes('rm -rf /')) {
return block('Refusing to delete the filesystem')
}
}
return allow()
}).run()
Installation
npm install claude-hook-kit
Requires Node.js ≥ 18.
What are Claude Code hooks?
Hooks are shell commands that Claude Code runs at specific lifecycle points. They receive a JSON payload on stdin and write a JSON response to stdout. Claude Code uses the response to decide whether to allow, block, or augment the operation.
| Event | When it fires | Can block? | Can inject context? |
|---|---|---|---|
PreToolUse |
Before any tool call | ✅ | ✅ |
PostToolUse |
After a tool call completes | ❌ | ✅ |
SessionStart |
On startup, resume, clear, compact | ❌ | ✅ |
UserPromptSubmit |
When the user submits a message | ✅ | ✅ |
Stop |
When Claude finishes a response | ✅ (force continue) | ❌ |
Register hooks in `~/.claude/settings.json`:
{
"hooks": {
"PreToolUse": [{
"matcher": "Bash",
"hooks": [{
"type": "command",
"command": "node /path/to/my-hook.js"
}]
}]
}
}
API
`defineHook(handler)`
The core function. Wraps your handler with stdin parsing, stdout serialization, and error handling.
import { defineHook, allow } from 'claude-hook-kit'
// Generic — no type parameter (untyped event)
defineHook(async (event) => allow())
Related Skills
Hook New
Create custom React hooks with TypeScript and best practices
Codex Agent SDK Go
Go SDK for the OpenAI Codex CLI app-server transport with JSON-RPC 2.0, typed events, approvals, MCP config, a
Agentrouter
Unofficial SDK for AgentRouter (agentrouter.org) — Claude, DeepSeek, and GLM via OpenAI-compatible proxy. Zero
Claude Code Headless
Programmatically drive the real Claude Code CLI in a PTY — structured semantic/screen/committed events, live t
ClaudeCodeSharpSDK
CLI-first .NET / C# SDK for Claude Code CLI with typed thread API, streamed JSONL events, structured outputs
TS Anaf
TypeScript SDK, CLI, and MCP server for Romania's ANAF e-Factura system.
Related Agents
Hook Author
Auteur de hooks agentiques Hookstack (.claude/hooks/.mjs). Utiliser pour créer ou modifier un hook du catalogu
Hook Agent
Expert React custom hooks - data fetching, behavior encapsulation, TypeScript
Release V0.3.0 - Strongly-Typed Hooks & Production-Grade Quality
Release Date: 2025-10-21 Type: Major Release (Breaking Changes) Status: ✅ Ready for Release ---