arktype
Installation
SKILL.md
ArkType
ArkType is a runtime validation library for TypeScript that uses a syntax-first approach—definitions look exactly like TypeScript code. Unlike builder-pattern libraries (Zod, Yup), ArkType JIT-compiles schemas into optimized validators, achieving 10x-100x performance improvements.
Core Principles
- Write TypeScript syntax, not builder chains -
"string >= 8"instead of.string().min(8) - Zero drift between static and runtime types - Automatic type inference from definitions
- JIT compilation for performance - Schemas compile to optimized JavaScript functions
- Native recursion support - Use Scopes for circular references without
lazy()wrappers - Transform during validation - Morphs allow data transformation in the validation pipeline
- Standard Schema compliant - Works with React Hook Form, TanStack Query, tRPC, and other modern libraries
- Type-level performance matters - Track both runtime speed AND TypeScript compiler instantiations
- String definitions for simple types - Use
type("string")for primitives - Object definitions for structures - Use
type({ name: "string" })for objects - Scopes for complex models - Use
scope({ ... })for interconnected types