Custom Hooks

Tùy chỉnh workflow vibe coding với hooks cho Claude Code. Tự động notifications, actions, và integrations.

Custom Hooks là gì?
Claude Code hooks là shell commands chạy khi có events như tool calls, session start, hoặc agent completion. Hooks nằm trong ~/.claude/settings.json và có thể tự động hóa workflow của bạn.

Thêm hooks sắp ra mắt...

Slack notifications, Telegram alerts, auto-commit, và nhiều hơn!

Số lượng Hooks

ClaudeKit có 13 hooks trong bản stable và 15 hooks trong bản beta. Tất cả hooks dùng chung một thư viện utility.

13 hooks — stable 15 hooks — beta

Hook Utility Library

Tất cả hooks dùng chung các utility modules trong hooks/lib/. Các module này xử lý các concerns chung để mỗi hook tập trung vào nhiệm vụ của mình.

ck-config-utils Read/validate .ck.json configuration
colors ANSI color formatting for terminal output
config-counter Track skills, hooks, agents counts
context-builder Build session context with WARN 70%/CRITICAL 90% thresholds
git-info-cache Cache git status for performance
hook-logger Structured logging for hooks
privacy-checker Block access to sensitive files (.env, credentials)
project-detector Detect project type and package manager
scout-checker Check if scout agents are available
transcript-parser Parse Claude conversation transcripts

Beta Hooks

Beta

Hai hooks mới ra mắt trong bản beta cùng với lifecycle event Stop mới.

session-state.cjs

Lưu và khôi phục tiến trình session qua các lần compact. Lưu plan hiện tại, todo items, subagent outputs, và trạng thái branch/commit vào .claude/session-state/.last-state.md. Triggers: SessionStart (load), Stop/SubagentStop (persist). 159 dòng.

plan-format-kanban.cjs

Kiểm tra định dạng link trong plan.md. Triggers: PostToolUse trên các thao tác Write/Edit. 61 dòng.

Mới: Stop lifecycle event

Beta thêm trigger Stop khi session kết thúc. Được dùng bởi session-state.cjs để lưu state trước khi tắt.

Cấu trúc Test: Tests được di chuyển từ hooks/tests/ → hooks/__tests__/ (theo pattern Jest) để tương thích tốt hơn với tooling.

Tìm hiểu thêm các built-in hooks của ClaudeKit tại ClaudeKit Documentation