Hooks
Hooks are an event-driven automation mechanism that executes predefined operations or workflows automatically in response to specific trigger events, such as file saves or code commits. Core characteristics include deep integration with the development workflow, support for custom trigger conditions and response actions, and the ability to complete tasks such as testing, formatting, and building without manual intervention. Hooks are widely used in development tools and IDEs to increase automation and development efficiency.
Core Facts
Hooks are an event-driven automated trigger mechanism that automatically triggers preset subsequent actions when a specific operation is completed.
Hooks adopt a lazy-loading design, loading into the context only when triggered and not occupying context space at other times.
Gemini CLI's secret-scanning hook can automatically intercept file write operations that contain hardcoded API keys.
Timeline (last 90 days)
Factory Droid's Hooks allow custom actions to be triggered at specific points in the Droid execution flow, with their own storage locations and purposes.
In Claude Code, CLAUDE.md manages persistent background, Skills manage reusable workflows, Hooks manage mandatory checkpoints, and MCP manages external data access.
X-Helix's Hooks mechanism is used to define at which nodes reviews are triggered and which steps require manual review.
Hooks scripts run with local permissions, so hardcoding sensitive credentials in them should be avoided.
Skills in Claude Code are reusable instruction packages, Subagents are sub-agents with independent context windows, and Hooks are check scripts that trigger automatically on specific events (such as before or after tool calls).
The content covered by Claude Code Quest includes basic command-line operations as well as advanced features such as Skills, Hooks, Subagents, and MCP.
Hooks are a hook mechanism that automatically triggers scripts at key points of tool calls, used for validation, interception, or logging.
The Hooks mechanism in Claude Code plugins allows a plugin to automatically execute preset programs when specific events are triggered, with file and network access permissions equal to those of the user account.
Hooks are Shell commands bound to session lifecycle events (such as before and after tool calls, and at session end), enforced by the Claude Code runtime without relying on model decisions, making them suitable for deterministic quality gates.
Claude Code can automatically leave traces on Trace Canvas through the Hooks mechanism, recording the session process.
34 more timeline events
All Facts (20)
Hooks are an event-driven automated trigger mechanism that automatically triggers preset subsequent actions when a specific operation is completed.
65%VerifiedHooks adopt a lazy-loading design, loading into the context only when triggered and not occupying context space at other times.
65%VerifiedGemini CLI's secret-scanning hook can automatically intercept file write operations that contain hardcoded API keys.
65%UnverifiedPlugin将Skills、Hooks和MCP配置打包成单个可安装包,新工程师安装后可立即拥有与资深同事相同的上下文和能力
90%UnverifiedThe Hooks stop hook can reflect on what happened at the end of a session and suggest CLAUDE.md updates, while the start hook can dynamically load team-specific context.
90%UnverifiedKiro提供Hooks开发钩子机制,将Git Hooks和CI/CD流水线的自动化能力与AI能力结合,在本地开发阶段触发
90%UnverifiedClaude Code的Hooks机制是确定性的,每次都会执行,而Claude.md中的提示词指令是概率性的,可能被遗漏
85%UnverifiedHooks和Skills的核心区别在于:Skill是模型主动调用的拉模式(Pull),Hook是外部系统被动触发的推模式(Push)
85%UnverifiedClaude Code的Hooks机制包括停止钩子(会话结束时自动提议更新CLAUDE.md)和启动钩子(自动加载最新上下文信息)
85%UnverifiedClaude Code's Hooks system provides 29 event hooks, drawing on the event-driven architectural design of Git Hooks.
80%UnverifiedClaude Code's Hooks mechanism is a hard constraint that AI cannot bypass at all; it can set mandatory checkpoints in the AI action chain to prevent unauthorized operations caused by model hallucinations or misjudgments.
80%UnverifiedUsing code hooks for hard interception is more reliable than placing safety rules in prompts and relying on the model to self-enforce them, because the model can be bypassed or produce hallucinations.
60%UnverifiedClaude Code's Hooks allow events in the agent loop to be intercepted and bash commands or scripts to be executed upon triggering, configured in settings.json under the .claude/hooks directory.
60%UnverifiedThe pre-tool hook is triggered immediately before the tool function body executes.
60%UnverifiedMaking good use of Hooks can reduce a large amount of unnecessary rework, improving development efficiency by at least double.
60%UnverifiedHooks are programmatic hard constraints enforced through an event-driven mechanism that does not rely on the model's self-discipline, making them more reliable than the soft constraint approach of CLAUDE.md.
60%UnverifiedIn Claude Code Hooks, exit code 0 means pass-through, exit code 2 means hard block (the AI will not retry), and other non-zero exit codes mean soft warnings.
60%UnverifiedClaude Code's tool harness is built around five extension points: CLAUDE.md files, Hooks, Skills, Plugins, and LSP integration with MCP servers.
60%UnverifiedKiro的两大核心功能是Specs(规范)和Hooks(开发钩子)
60%UnverifiedGemini CLI's hook mechanism can intercept AI-generated content before it is written to disk, which constitutes a Shift-Left Security practice.
60%