重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
pattern-schema by commontoolsinc/labs
npx skills add https://github.com/commontoolsinc/labs --skill pattern-schema使用 Skill("ct") 在运行命令时获取 ct CLI 文档。
在编写任何模式代码之前,创建包含所有数据类型以及输入/输出类型的 schemas.tsx 文件。
docs/common/concepts/types-and-schemas/default.mddocs/common/concepts/types-and-schemas/writable.mddocs/common/concepts/pattern.md (输入/输出部分)pattern<Input, Output>() - 切勿使用单类型 pattern<State>()。单类型模式无法通过 进行测试。广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
.send()Writable<>(用于写入访问)Writable<> - 它们反映返回的数据结构Default<T, value>Stream<T>(启用测试和链接)[NAME]: string 和 [UI]: VNodeimport { Default, NAME, Stream, UI, VNode, Writable } from "commontools";
// ============ 数据类型 ============
export interface Item {
name: Default<string, "">;
done: Default<boolean, false>;
}
// ============ 模式输入/输出 ============
export interface ItemInput {
item: Writable<Item>; // 输入中的 Writable = 模式将修改
}
export interface ItemOutput {
[NAME]: string; // 子模式必需
[UI]: VNode; // 子模式必需
item: Item; // 输出中不使用 Writable
toggle: Stream<void>; // 动作作为 Stream<T>
}
deno task ct check schemas.tsx --no-run每周安装量
41
代码仓库
GitHub 星标数
30
首次出现
2026年1月21日
安全审计
安装于
opencode41
gemini-cli41
cursor41
continue40
kimi-cli40
antigravity40
Use Skill("ct") for ct CLI documentation when running commands.
Create schemas.tsx with all data types and Input/Output types BEFORE any pattern code.
docs/common/concepts/types-and-schemas/default.mddocs/common/concepts/types-and-schemas/writable.mddocs/common/concepts/pattern.md (Input/Output section)pattern<Input, Output>() - Never use single-type pattern<State>(). Single-type patterns cannot be tested via .send().Writable<> in Input type (for write access)Writable<> - they reflect returned data shapeDefault<T, value>Stream<T> (enables testing and linking)[NAME]: string and [UI]: VNode in Output typeimport { Default, NAME, Stream, UI, VNode, Writable } from "commontools";
// ============ DATA TYPES ============
export interface Item {
name: Default<string, "">;
done: Default<boolean, false>;
}
// ============ PATTERN INPUT/OUTPUT ============
export interface ItemInput {
item: Writable<Item>; // Writable in Input = pattern will modify
}
export interface ItemOutput {
[NAME]: string; // Required for sub-patterns
[UI]: VNode; // Required for sub-patterns
item: Item; // No Writable in Output
toggle: Stream<void>; // Actions as Stream<T>
}
deno task ct check schemas.tsx --no-runWeekly Installs
41
Repository
GitHub Stars
30
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode41
gemini-cli41
cursor41
continue40
kimi-cli40
antigravity40
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
127,000 周安装