contract-typebox

Define TypeBox schemas for shared API contracts and runtime validation.

Updated Mar 25, 2026
One-click install
npx skills add https://github.com/MileniumTick/skills --skill contract-typebox
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: contract-typebox
Source: https://github.com/MileniumTick/skills/tree/main/skills/contract-typebox
Command: npx skills add https://github.com/MileniumTick/skills --skill contract-typebox

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TypeBox enables runtime schema validation for API contracts, reducing manual validation boilerplate and preventing invalid data from flowing through services.

Core Features & Use Cases

  • Schema patterns: Type.Object based contracts for common payloads (User, Auth, Pagination) shared across backend and frontend.
  • Runtime validation: Centralized validation against TypeBox schemas in API routes and UI layers.
  • Use Case: Define a single contract in packages/shared/contracts and reuse it in Elysia routes and frontend validation.

Quick Start

Import TypeBox schemas from shared/contracts and apply them to a route validator to enforce API contracts.

Frequently Asked Questions about contract-typebox

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I share API contracts between frontend and backend using TypeBox?

To share API contracts using TypeBox, you define Type.Object schemas in a shared package and import them in Elysia backend routes and frontend validation flows to enforce runtime checks.

What is the best way to validate API payloads with TypeBox and Elysia?

The best way to validate API payloads with TypeBox and Elysia is to import shared schemas from your contracts directory and apply them directly as route validators to prevent invalid data from flowing through services.

How does runtime schema validation work for shared TypeScript contracts?

Runtime schema validation for shared TypeScript contracts works by applying TypeBox schemas to incoming data, ensuring payloads like User and Pagination conform to defined Type.Object structures before processing.

Can I compose nested schemas for API contracts in TypeBox?

Yes, you can compose nested schemas for API contracts in TypeBox by structuring Type.Object exports with optional nested properties, enabling complex payload validation across shared frontend and backend flows.

Why do I need TypeBox schemas if I already use TypeScript?

You need TypeBox schemas alongside TypeScript because TypeScript only checks types at compile time, whereas TypeBox provides runtime validation to prevent invalid data from entering your API routes and UI layers.

Does TypeBox support shared contract structures for pagination and auth?

TypeBox supports shared contract structures for pagination and auth by defining Type.Object schemas that centralize validation logic and reduce manual boilerplate across services.