重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
typebox by epicenterhq/epicenter
npx skills add https://github.com/epicenterhq/epicenter --skill typebox使用 typebox,而非 @sinclair/typebox。@sinclair/typebox 包已弃用。
// 正确
import { Type } from 'typebox';
import { Compile } from 'typebox/compile';
import { Value } from 'typebox/value';
// 错误 - 已弃用
import { Type } from '@sinclair/typebox';
| 需求 | 使用工具 |
|---|---|
| 定义模式 | typebox 配合 Type.* |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 标准模式支持 | @sinclair/typemap |
| 库间转换 | @sinclair/typemap |
| 高性能验证 | 任一工具的 Compile() |
| 一次性验证 | typebox 的 Value.Check() |
TypeBox 本身不原生实现标准模式。请使用 TypeMap:
import { Compile } from '@sinclair/typemap';
import { Type } from 'typebox';
// 从 TypeBox 模式
const validator = Compile(
Type.Object({
name: Type.String(),
age: Type.Number(),
}),
);
// 标准模式接口
const result = validator['~standard'].validate({ name: 'Alice', age: 30 });
TypeMap 的 Compile() 接受:
import { Compile } from '@sinclair/typemap';
// TypeScript 语法字符串
const v1 = Compile(`{ name: string, age: number }`);
// TypeBox 模式
const v2 = Compile(Type.Object({ x: Type.Number() }));
// Zod 模式
const v3 = Compile(z.object({ x: z.number() }));
// Valibot 模式
const v4 = Compile(v.object({ x: v.number() }));
所有调用都会返回带有 ['~standard'].validate() 的验证器。
// TypeBox Compile - 返回带有 Check/Parse 的验证器
import { Compile } from 'typebox/compile';
const validator = Compile(schema);
validator.Check(value); // 布尔值
validator.Parse(value); // 抛出异常或返回类型化值
// TypeMap Compile - 返回标准模式验证器
import { Compile } from '@sinclair/typemap';
const validator = Compile(schema);
validator['~standard'].validate(value); // { value } 或 { issues }
当你需要标准模式兼容性时,使用 TypeMap。否则,直接使用 TypeBox。
TypeMap 可在不同库之间进行转换:
import { Syntax, TypeBox, Zod, Valibot } from '@sinclair/typemap';
const syntax = `{ name: string }`;
const tbSchema = TypeBox(syntax);
const zodSchema = Zod(syntax);
const valibotSchema = Valibot(syntax);
const backToSyntax = Syntax(zodSchema);
TypeMap 编译后的验证器比原生 Zod 快约 100 倍:
| 库 | 1000 万次迭代耗时 |
|---|---|
| Zod 原生 | ~4,669 毫秒 |
| TypeMap | ~47 毫秒 |
每周安装量
50
代码仓库
GitHub 星标数
4.3K
首次出现
2026 年 1 月 28 日
安全审计
安装于
github-copilot47
gemini-cli47
opencode46
codex46
kimi-cli46
amp46
Usetypebox, not @sinclair/typebox. The @sinclair/typebox package is deprecated.
// Correct
import { Type } from 'typebox';
import { Compile } from 'typebox/compile';
import { Value } from 'typebox/value';
// Wrong - deprecated
import { Type } from '@sinclair/typebox';
| Need | Use |
|---|---|
| Define schemas | typebox with Type.* |
| Standard Schema support | @sinclair/typemap |
| Translate between libraries | @sinclair/typemap |
| High-performance validation | Compile() from either |
| One-off validation | Value.Check() from typebox |
TypeBox doesn't implement Standard Schema natively. Use TypeMap:
import { Compile } from '@sinclair/typemap';
import { Type } from 'typebox';
// From TypeBox schema
const validator = Compile(
Type.Object({
name: Type.String(),
age: Type.Number(),
}),
);
// Standard Schema interface
const result = validator['~standard'].validate({ name: 'Alice', age: 30 });
Compile() from TypeMap accepts:
import { Compile } from '@sinclair/typemap';
// TypeScript syntax strings
const v1 = Compile(`{ name: string, age: number }`);
// TypeBox schemas
const v2 = Compile(Type.Object({ x: Type.Number() }));
// Zod schemas
const v3 = Compile(z.object({ x: z.number() }));
// Valibot schemas
const v4 = Compile(v.object({ x: v.number() }));
All return validators with ['~standard'].validate().
// TypeBox Compile - returns Validator with Check/Parse
import { Compile } from 'typebox/compile';
const validator = Compile(schema);
validator.Check(value); // boolean
validator.Parse(value); // throws or returns typed value
// TypeMap Compile - returns Standard Schema validator
import { Compile } from '@sinclair/typemap';
const validator = Compile(schema);
validator['~standard'].validate(value); // { value } or { issues }
Use TypeMap when you need Standard Schema compatibility. Use TypeBox directly when you don't.
TypeMap translates between libraries:
import { Syntax, TypeBox, Zod, Valibot } from '@sinclair/typemap';
const syntax = `{ name: string }`;
const tbSchema = TypeBox(syntax);
const zodSchema = Zod(syntax);
const valibotSchema = Valibot(syntax);
const backToSyntax = Syntax(zodSchema);
TypeMap's compiled validators are ~100x faster than native Zod:
| Library | 10M iterations |
|---|---|
| Zod native | ~4,669ms |
| TypeMap | ~47ms |
Weekly Installs
50
Repository
GitHub Stars
4.3K
First Seen
Jan 28, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
github-copilot47
gemini-cli47
opencode46
codex46
kimi-cli46
amp46
Node.js 环境配置指南:多环境管理、类型安全与最佳实践
10,500 周安装
GitHub Copilot for Azure 技能创作指南:规范、令牌预算与渐进式披露
948 周安装
GitHub代码安全审计工具 - 自动化查找缺陷、安全漏洞与代码质量问题
1,000 周安装
Python Excel自动化:openpyxl库操作XLSX文件教程,创建编辑格式化电子表格
961 周安装
数据分析技能:使用DuckDB高效分析Excel/CSV文件,支持SQL查询与统计摘要
966 周安装
Sensei:GitHub Copilot for Azure技能合规性自动化改进工具
965 周安装
video-frames:使用ffmpeg从视频中提取单帧和缩略图的命令行工具
998 周安装