hooks
✓創建和管理 Claude Code 掛鉤,以實現工作流程自動化、驗證輸入和自定義行為。當用戶請求創建掛鉤、設置工具使用自動化(PreToolUse、PostToolUse)、添加會話上下文(SessionStart)、驗證提示(UserPromptSubmit)、控制停止行為(Stop、SubagentStop)或配置權限處理(PermissionRequest)時使用。
SKILL.md
Create and configure Claude Code hooks to automate workflows, validate inputs, add context, and customize behavior across different events in the Claude Code lifecycle.
MANDATORY FIRST STEP: Before creating any hook, fetch the latest hooks documentation:
This ensures access to the most current hook events, JSON schemas, and best practices.
創建和管理 Claude Code 掛鉤,以實現工作流程自動化、驗證輸入和自定義行為。當用戶請求創建掛鉤、設置工具使用自動化(PreToolUse、PostToolUse)、添加會話上下文(SessionStart)、驗證提示(UserPromptSubmit)、控制停止行為(Stop、SubagentStop)或配置權限處理(PermissionRequest)時使用。 來源:benjaming/ai-skills。
可引用資訊
為搜尋與 AI 引用準備的穩定欄位與指令。
- 安裝指令
npx skills add https://github.com/benjaming/ai-skills --skill hooks- 分類
- </>開發工具
- 認證
- ✓
- 收錄時間
- 2026-02-05
- 更新時間
- 2026-02-18
快速解答
什麼是 hooks?
創建和管理 Claude Code 掛鉤,以實現工作流程自動化、驗證輸入和自定義行為。當用戶請求創建掛鉤、設置工具使用自動化(PreToolUse、PostToolUse)、添加會話上下文(SessionStart)、驗證提示(UserPromptSubmit)、控制停止行為(Stop、SubagentStop)或配置權限處理(PermissionRequest)時使用。 來源:benjaming/ai-skills。
如何安裝 hooks?
開啟你的終端機或命令列工具(如 Terminal、iTerm、Windows Terminal 等) 複製並執行以下指令:npx skills add https://github.com/benjaming/ai-skills --skill hooks 安裝完成後,技能將自動設定到你的 AI 程式設計環境中,可以在 Claude Code 或 Cursor 中使用
這個 Skill 的原始碼在哪?
https://github.com/benjaming/ai-skills