docs(skills): hook 示例改用 defineHook(),不再教裸 : Hook 字面量 (#4274) - #4283
Merged
Conversation
…k` literals (#4274) #4273 shipped defineHook() and pointed docs + error prescriptions at it, but skills/objectstack-data — the first thing an AI author reads — still taught the bare-literal form in 18 places across SKILL.md, rules/hooks.md, rules/validation.md, and references/data-hooks.md. Mechanical rewrite: `const x: Hook = {…}` → `const x = defineHook({…})` (imports switched to the value import), plus the factory-over-bare-literal note in rules/hooks.md and references/data-hooks.md, phrased identically to the schema.mdx note from #4273. Every rewritten block was scanned for unknown top-level keys — HookSchema is strict, so a stray key inside a defineHook() example would teach a crash — none found; the os:check gate covers the tagged blocks (198 examples green). Closes #4274 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Same convention as #4279: the changeset gate wants an explicit statement of release intent, and skills/ ships in no npm package. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4274(#4269 / #4273 的后续)。
#4273 落地了
defineHook(),schema.mdx与object.zod.ts的处方均已指向工厂,但 skills(AI 作者的第一入口)还在 18 处教旧姿势 —— AI 照 skill 写出的 hook 拿到 tsc 绿就报告完成,「import 即校验」闭环在最主要受众上落空。改动(纯文档,机械替换)
const x: Hook = {…}→const x = defineHook({…})×18,涉及:SKILL.md(os:check 打标块 + CRM 蓝图表格行措辞)rules/hooks.md(Quick Reference)rules/validation.md(外部校验示例)references/data-hooks.md(定义示例、fillPositionOnHire 打标块、cookbook ×10、Method 3 约定扫描、组合/条件示例)rules/hooks.md、references/data-hooks.md定义节),与 feat(spec): 补上 defineHook() 作者侧工厂,并修正 object.zod.ts 两处错误处方 (#4269) #4273 在schema.mdx的注记同款措辞。import { defineHook, HookContext }),无残留未用的Hook类型导入。防「照抄即崩」核查
HookSchema是 strict 的 —— 包上defineHook()后,示例里的未知顶层键会从装饰性类型变成运行时抛错。对全部 15 个改写块扫描顶层键,均只含合法 schema 键,无一例外。验证
check:skill-examples:198 个 prose 片段对构建后 dist 类型检查全绿(含本次改写的打标块)。🤖 Generated with Claude Code