Skip to main content

cursor-hooks

File-based agent loop hooks via `.cursor/hooks.json` — pre/post commands, governance gates. Use when enforcing policy without modifying agent prompts.

来源信息

仓库
HKTITAN/cursor-sdk
最近来源活动
2026年5月3日 08:23
检测到的 SKILL.md 语言
英语
星标
2
分支
0

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

文件资源管理器
4 个文件

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
cursor-hooks
description
File-based agent loop hooks via `.cursor/hooks.json` — pre/post commands, governance gates. Use when enforcing policy without modifying agent prompts.
metadata
{"internal":false,"source":"https://cursor.com/docs/sdk/typescript"}
# cursor-hooks Hooks are **file-based**, not programmatic. The SDK does not expose JS callbacks for the agent loop — use `.cursor/hooks.json` and rely on `local.settingSources` to load them. ## When to use - Lint / type-check gates before agent commits - Audit logging or compliance commands after each turn - Fail-fast policies that must run regardless of prompt ## Concepts - [[references/file-format]] — `.cursor/hooks.json` shape - [[references/loading]] — `settingSources` and project vs user vs team scope - [[references/programmatic-alternatives]] — what to use when you need JS callbacks (`onDelta`, `onStep`) ## Cross-links - `local.settingSources` → [[../cursor-sdk/references/local-options]] - Stream-side observation → [[../cursor-runs/references/interaction-updates]] - Sibling `.cursor/` features → [[../cursor-rules/SKILL]] · [[../cursor-skills-system/SKILL]]
在 GitHub 查看