mcpField
T
typebox

typebox

github.com/epicenterhqDevelopment4.8k76 installsUpdated 2w ago
Repository

About typebox

A repository skill for choosing and using TypeBox in TypeScript projects. It explains schema creation, validation options, and when to use another schema library.

Key features

  1. 01Define portable schema objects
  2. 02Validate with Value.Check()
  3. 03Compile high-performance validators
  4. 04Guidance on schema boundaries

Use cases

  1. 01Define workspace table schemas
  2. 02Validate a value once
  3. 03Validate repeatedly with compiled schemas

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/epicenterhq/epicenter --skill typebox

After installing, type/typeboxin Claude Code to confirm it loaded.

Details

From the project README

TypeBox

Package Names

Use typebox, 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';

When to Use What

NeedUse
Define schemastypebox with Type.*
One-off validationValue.Check() from typebox/value
High-performance validationCompile() from typebox/compile

TypeBox schemas are portable JSON Schema-shaped data. If a TypeBox boundary needs validation, validate the TypeBox schema directly:

import { Type } from 'typebox';
import { Compile } from 'typebox/compile';
import { Value } from 'typebox/value';

const schema = Type.Object({ name: Type.String(), age: Type.Number() });

Value.Check(schema, value); // boolean

const validator = Compile(schema);
validator.Check(value); // boolean
validator.Parse(value); // throws or returns typed value

Standard Schema Boundary

TypeBox does not implement Standard Schema. Do not write TypeBox code that expects schema['~standard']. If a boundary accepts Standard Schema, prefer Arktype or another schema library that implements it natively. If a boundary owns TypeBox schemas, keep the boundary TypeBox-native and use JSON Schema as the portable representation.

Repo Policy

Use TypeBox for portable schema objects: workspace tables, kv, fields, actions, MCP inputs, manifests, and other surfaces that need JSON Schema shape, metadata, Static<>, or schema inspection. Use Arktype for local runtime validation, request parsing, env/config parsing, persisted UI state, transforms, and branded domain values.

References

Comments

Markdown supported