ArkType Validation Overview ArkType is a TypeScript-native runtime validation library that defines schemas using string expressions mirroring TypeScript syntax, providing editor autocomplete, syntax highlighting, and optimized validators. Use when building type-safe APIs, validating JSON payloads, or replacing Zod with a more TypeScript-idiomatic approach. Not suitable for projects that need Zod ecosystem compatibility or JSON Schema output. Package: Quick Reference | Pattern | Usage | | --------------------------------- | ----------------------------------------------- | | | Define object sc…

);\n// Regex\u003c`${bigint}.${bigint}.${bigint}`, { captures: [...] }>\n\nconst email = regex('^(?\u003cname>\\\\w+)@(?\u003cdomain>\\\\w+\\\\.\\\\w+)

ArkType Validation Overview ArkType is a TypeScript-native runtime validation library that defines schemas using string expressions mirroring TypeScript syntax, providing editor autocomplete, syntax highlighting, and optimized validators. Use when building type-safe APIs, validating JSON payloads, or replacing Zod with a more TypeScript-idiomatic approach. Not suitable for projects that need Zod ecosystem compatibility or JSON Schema output. Package: Quick Reference | Pattern | Usage | | --------------------------------- | ----------------------------------------------- | | | Define object sc…

);\n// Named capture groups are typed\n```\n\nFor most validation, ArkType's built-in `string.email`, `string.semver`, or inline `/regex/` syntax is sufficient. Use `arkregex` when you need typed capture groups or compile-time string type inference.\n","content_type":"text/markdown; charset=utf-8","language":"markdown","size":6496,"content_sha256":"e289e894e7337bc86e803e65c598a77533625e2a8c8afd2d82ea338fb2a10904"},{"filename":"references/schema-types.md","content":"---\ntitle: Schema Types\ndescription: ArkType primitives, string keywords, number constraints, objects with optional and default properties, arrays, tuples, unions, literals, regex patterns, and inline constraints\ntags:\n [\n type,\n string,\n number,\n boolean,\n object,\n array,\n tuple,\n union,\n literal,\n optional,\n default,\n constraints,\n regex,\n email,\n url,\n uuid,\n semver,\n integer,\n ]\n---\n\n# Schema Types\n\n## Primitives\n\nArkType supports both string syntax and fluent API:\n\n```ts\nimport { type } from 'arktype';\n\n// String syntax\nconst str = type('string');\nconst num = type('number');\nconst bool = type('boolean');\nconst bigint = type('bigint');\nconst sym = type('symbol');\nconst date = type('Date');\n\n// Fluent API\nconst str2 = type.string;\nconst num2 = type.number;\nconst bool2 = type.boolean;\n```\n\n## String Keywords\n\nBuilt-in string format validators:\n\n```ts\n// Validators (return string)\ntype('string.email');\ntype('string.url');\ntype('string.uuid');\ntype('string.uuid.v4');\ntype('string.semver');\ntype('string.ip');\ntype('string.ip.v4');\ntype('string.ip.v6');\ntype('string.date');\ntype('string.date.iso');\ntype('string.numeric');\ntype('string.integer');\ntype('string.alpha');\ntype('string.alphanumeric');\ntype('string.digits');\ntype('string.hex');\ntype('string.creditCard');\ntype('string.base64');\ntype('string.base64.url');\ntype('string.json');\ntype('string.host'); // Hostname (IP or domain)\n\n// Morphs (transform the value)\ntype('string.trim'); // Trims whitespace\ntype('string.lower'); // Transforms to lowercase\ntype('string.upper'); // Transforms to uppercase\ntype('string.capitalize'); // Capitalizes first letter\ntype('string.normalize.NFC'); // Unicode normalization\ntype('string.json.parse'); // Parses JSON string at runtime\ntype('string.numeric.parse'); // Parses numeric string to number\ntype('string.integer.parse'); // Parses integer string to number\ntype('string.date.parse'); // Parses date string to Date\ntype('string.date.iso.parse'); // Parses ISO date string to Date\ntype('string.url.parse'); // Parses URL string to URL instance\n```\n\n## String Constraints\n\n```ts\ntype('string >= 1'); // Min length 1\ntype('string \u003c= 100'); // Max length 100\ntype('string >= 1 & string \u003c= 100'); // Range (intersection)\ntype('5 \u003c= string \u003c= 20'); // Range (compact syntax)\ntype('string == 5'); // Exact length\n\n// Regex patterns\ntype('/^[a-z]+$/');\ntype({ key: /^[a-z]+$/ }); // RegExp object\n```\n\n## Number Constraints\n\n```ts\ntype('number > 0'); // Positive\ntype('number >= 0'); // Non-negative\ntype('number \u003c 100'); // Less than 100\ntype('number % 2'); // Divisible by 2 (even)\ntype('number.integer'); // Integer only\ntype('number.safe'); // Safe integer range\ntype('number.epoch'); // Unix timestamp (safe integer >= 0)\ntype('number.port'); // Valid port (integer 0-65535)\ntype('number > 0 & number \u003c 100'); // Range (intersection)\ntype('0 \u003c= number \u003c= 100'); // Range (compact syntax)\ntype('1 \u003c= number.integer \u003c= 5'); // Constrained range\ntype('0 \u003c= number.integer % 5 \u003c= 100'); // Range + divisibility\n\n// Fluent API constraints\ntype.number.atLeast(0);\ntype.number.atMost(100);\ntype.number.moreThan(0);\ntype.number.lessThan(100);\ntype.number.divisibleBy(5);\n```\n\n## Objects\n\n```ts\nconst User = type({\n name: 'string',\n email: 'string.email',\n age: 'number >= 0',\n});\n\n// Infer TypeScript type\ntype User = typeof User.infer;\n// { name: string; email: string; age: number }\n```\n\n### Optional Properties\n\n```ts\nconst User = type({\n name: 'string',\n 'bio?': 'string', // Optional (question mark on key)\n 'age?': 'number',\n});\n```\n\n### Default Values\n\n```ts\nconst Config = type({\n 'theme = \"light\"': 'string',\n 'retries = 3': 'number',\n 'debug = false': 'boolean',\n});\n```\n\n### Undeclared Key Handling\n\n```ts\n// Inline syntax with \"+\"\nconst Strict = type({\n '+': 'reject',\n name: 'string',\n});\n\n// Fluent API\nconst StrictFluent = type({\n name: 'string',\n}).onUndeclaredKey('reject'); // Reject extra keys\n\nconst Strip = type({\n name: 'string',\n}).onUndeclaredKey('delete'); // Strip extra keys\n\n// Deep undeclared key handling (nested objects)\nconst DeepStrip = type({\n name: 'string',\n nested: {\n preserved: 'string',\n },\n}).onDeepUndeclaredKey('delete');\n```\n\n### Object Modifiers\n\n```ts\nconst User = type({\n name: 'string',\n email: 'string.email',\n 'age?': 'number',\n});\n\nUser.pick('name', 'email'); // Only name and email\nUser.omit('age'); // Remove age\nUser.merge({\n role: \"'admin' | 'user'\",\n});\n```\n\n## Arrays and Tuples\n\n```ts\n// Arrays\ntype('string[]');\ntype('number[]');\ntype('string.email[]');\n\n// In objects\nconst Team = type({\n members: 'string[]',\n scores: 'number[]',\n});\n\n// Tuples\ntype(['string', 'number']); // [string, number]\ntype(['string', 'number', '...', 'boolean[]']); // [string, number, ...boolean[]]\n```\n\n## Unions and Literals\n\n```ts\n// Unions\ntype('string | number');\ntype(\"'success' | 'error' | 'pending'\");\n\n// Literal values\ntype('true');\ntype('false');\ntype('0');\ntype(\"'active'\");\n\n// In objects\nconst Event = type({\n type: \"'click' | 'hover' | 'focus'\",\n target: 'string',\n 'data?': 'unknown',\n});\n```\n\n## Intersections\n\n```ts\n// Combine constraints\ntype('number > 0 & number \u003c 100 & number.integer');\ntype('string >= 1 & string \u003c= 50');\n\n// Object intersections\nconst Named = type({ name: 'string' });\nconst Aged = type({ age: 'number' });\nconst Person = Named.and(Aged);\n```\n\n## Date Constraints\n\n```ts\n// String syntax with date literals\nconst Bounded = type({\n dateInThePast: `Date \u003c ${Date.now()}`,\n dateAfter2000: \"Date > d'2000-01-01'\",\n dateAtOrAfter1970: 'Date >= 0',\n});\n\n// Fluent API\nconst FluentBounded = type({\n dateInThePast: type.Date.earlierThan(Date.now()),\n dateAfter2000: type.Date.laterThan('2000-01-01'),\n dateAtOrAfter1970: type.Date.atOrAfter(0),\n});\n```\n\n## Index Signatures and keyof\n\n```ts\n// Index signatures\ntype('Record\u003cstring, unknown>');\nconst Dict = type({ '[string]': 'number' });\n\n// Extract object keys as union type\nconst User = type({\n name: 'string',\n email: 'string.email',\n});\n\nconst UserKey = User.keyof();\ntype UserKey = typeof UserKey.infer; // \"name\" | \"email\"\n```\n\n## Special Types\n\n```ts\ntype('unknown'); // Any value\ntype('never'); // No value\ntype('void'); // undefined\ntype('null');\ntype('undefined');\ntype('object'); // Non-null object\ntype('Record\u003cstring, unknown>'); // String-keyed object\n```\n","content_type":"text/markdown; charset=utf-8","language":"markdown","size":6388,"content_sha256":"ad27049ca212a8c6e53db8c37e0aee23fa0c0f6076a9ea3b50a59d2b6b96f9f0"}],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"ArkType Validation","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Overview","type":"text"}]},{"type":"paragraph","content":[{"text":"ArkType is a TypeScript-native runtime validation library that defines schemas using string expressions mirroring TypeScript syntax, providing editor autocomplete, syntax highlighting, and optimized validators. Use when building type-safe APIs, validating JSON payloads, or replacing Zod with a more TypeScript-idiomatic approach. Not suitable for projects that need Zod ecosystem compatibility or JSON Schema output.","type":"text"}]},{"type":"paragraph","content":[{"text":"Package:","type":"text","marks":[{"type":"strong"}]},{"text":" ","type":"text"},{"text":"arktype","type":"text","marks":[{"type":"code_inline"}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Quick Reference","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Pattern","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Usage","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"type({ key: \"string\" })","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Define object schema","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"type(\"string\")","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Primitive type","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"string.email\"","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"\"string.url\"","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Built-in string validators","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"string.trim\"","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"\"string.lower\"","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Built-in string morphs (transforms)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"string.json.parse\"","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Parse JSON string to validated object","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"number > 0\"","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"\"string >= 1\"","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Inline constraints","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"string | number\"","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Union types","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"'a' | 'b' | 'c'\"","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"String literal unions","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"string[]\"","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Array types","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"key?\": \"string\"","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Optional properties","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"key = 'default'\"","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Default values","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":".pipe()","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":".to()","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Transform output (morphs)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":".narrow()","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Custom validation (like Zod refine)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":".pick()","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":".omit()","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Object property selection","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":".merge()","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Combine object types","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"scope({...}).export()","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Named type scopes with cross-references","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"type(\"\u003ct>\", { box: \"t\" })","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Generic type definitions","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"type.errors","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Error handling (check ","type":"text"},{"text":"instanceof type.errors","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":".assert(data)","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Throws on invalid input instead of returning","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"(number % 2)#even\"","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Branding — type-only validated marker","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"0 \u003c= number \u003c= 100\"","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Compact range constraints","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"configure()","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Global defaults (from ","type":"text"},{"text":"arktype/config","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"match()","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Type-safe pattern matching (2.1)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"+\" : \"reject\"","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Inline undeclared key handling","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"arkenv({ PORT: \"number\" })","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Typesafe env var validation (ArkEnv)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"arkenvVitePlugin(Env)","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Build-time env validation for Vite","type":"text"}]}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Common Mistakes","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Mistake","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Fix","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"type(\"string.email()\")","type":"text","marks":[{"type":"code_inline"}]},{"text":" with parens","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"type(\"string.email\")","type":"text","marks":[{"type":"code_inline"}]},{"text":" (no parens)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Checking errors with ","type":"text"},{"text":"=== null","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Use ","type":"text"},{"text":"instanceof type.errors","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"{ key: \"string?\" }","type":"text","marks":[{"type":"code_inline"}]},{"text":" for optional","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"{ \"key?\": \"string\" }","type":"text","marks":[{"type":"code_inline"}]},{"text":" (question mark on key)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Importing from ","type":"text"},{"text":"arktype/types","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Import ","type":"text"},{"text":"type","type":"text","marks":[{"type":"code_inline"}]},{"text":" and ","type":"text"},{"text":"scope","type":"text","marks":[{"type":"code_inline"}]},{"text":" from ","type":"text"},{"text":"\"arktype\"","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Nested ","type":"text"},{"text":"type()","type":"text","marks":[{"type":"code_inline"}]},{"text":" in string expressions","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Use ","type":"text"},{"text":"scope()","type":"text","marks":[{"type":"code_inline"}]},{"text":" for cross-referencing types","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Raw ","type":"text"},{"text":".pipe()","type":"text","marks":[{"type":"code_inline"}]},{"text":" without error handling","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Use ","type":"text"},{"text":".pipe.try()","type":"text","marks":[{"type":"code_inline"}]},{"text":" for operations that can throw","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"string.lowercase\"","type":"text","marks":[{"type":"code_inline"}]},{"text":" for case morph","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"string.lower\"","type":"text","marks":[{"type":"code_inline"}]},{"text":" (also ","type":"text"},{"text":"\"string.upper\"","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Configuring after importing ","type":"text"},{"text":"arktype","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Import ","type":"text"},{"text":"arktype/config","type":"text","marks":[{"type":"code_inline"}]},{"text":" before ","type":"text"},{"text":"arktype","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Manual ","type":"text"},{"text":"process.env","type":"text","marks":[{"type":"code_inline"}]},{"text":" parsing","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Use ","type":"text"},{"text":"arkenv()","type":"text","marks":[{"type":"code_inline"}]},{"text":" for auto-coercion and validation","type":"text"}]}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Delegation","type":"text"}]},{"type":"paragraph","content":[{"text":"Use this skill for ArkType schema definitions, runtime validation, morphs/transforms, scopes, and type inference. For Zod-based validation, delegate to the zod-validation skill.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"References","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Schema Types","type":"text","marks":[{"type":"link","attrs":{"href":"references/schema-types.md","title":null}}]},{"text":" — primitives, string keywords, number constraints, objects, arrays, tuples, unions, optional, defaults","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Morphs and Scopes","type":"text","marks":[{"type":"link","attrs":{"href":"references/morphs-and-scopes.md","title":null}}]},{"text":" — pipe, morph transforms, narrow validation, scopes, recursive types, generics, global configuration, pattern matching","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Common Patterns","type":"text","marks":[{"type":"link","attrs":{"href":"references/common-patterns.md","title":null}}]},{"text":" — JSON parsing, form validation, API responses, error handling, ArkEnv environment variables, Vite plugin, comparison with Zod","type":"text"}]}]}]},{"type":"hr","attrs":{"markup":"---"}}]},"metadata":{"date":"2026-06-05","name":"arktype-validation","author":"@skillopedia","source":{"stars":12,"repo_name":"agent-skills","origin_url":"https://github.com/oakoss/agent-skills/blob/HEAD/skills/arktype-validation/SKILL.md","repo_owner":"oakoss","body_sha256":"e202db2dae0ea476d4fd4f572fb74a58a060919089dfae900c71959b115f7ff2","cluster_key":"ae9b2fa550b8fcb49e839b740865fcf159768fa884572d29454628b6e253a789","clean_bundle":{"format":"clean-skill-bundle-v1","source":"oakoss/agent-skills/skills/arktype-validation/SKILL.md","attachments":[{"id":"5d73fbd9-7f8e-5029-81a8-a80c3e0f5fec","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/5d73fbd9-7f8e-5029-81a8-a80c3e0f5fec/attachment.md","path":"references/common-patterns.md","size":9177,"sha256":"e52f3ca4df907956a157fd6da39c951ef4f4afde7c09fe38f7de24792bbd6fc6","contentType":"text/markdown; charset=utf-8"},{"id":"1018fd6d-2cc0-5b64-8ffb-2da3f20448e2","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/1018fd6d-2cc0-5b64-8ffb-2da3f20448e2/attachment.md","path":"references/morphs-and-scopes.md","size":6496,"sha256":"e289e894e7337bc86e803e65c598a77533625e2a8c8afd2d82ea338fb2a10904","contentType":"text/markdown; charset=utf-8"},{"id":"091c8c65-d8eb-5f02-aaa2-b28177272686","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/091c8c65-d8eb-5f02-aaa2-b28177272686/attachment.md","path":"references/schema-types.md","size":6388,"sha256":"ad27049ca212a8c6e53db8c37e0aee23fa0c0f6076a9ea3b50a59d2b6b96f9f0","contentType":"text/markdown; charset=utf-8"}],"bundle_sha256":"eb6b43342b6c19bfdbb6d5aa8efd89919afd73a55a6bba27329336bc3ccb7c97","attachment_count":3,"text_attachments":3,"attachment_storage":"skillopedia-attachments-v1","binary_attachments":0,"excluded_attachments":[]},"cluster_size":1,"skill_md_path":"skills/arktype-validation/SKILL.md","import_metadata":{"date":"2026-06-05","author":"@skillopedia","version":"v1","category":"web-development","category_label":"Web"},"exact_dupes_collapsed_into_this":0},"license":"MIT","version":"v1","category":"web-development","metadata":{"author":"oakoss","version":"1.2"},"import_tag":"clean-skills-v1","description":"ArkType runtime validation with TypeScript-native syntax. Type-safe schemas using string expressions, morphs, scopes, and generics. Includes ArkEnv for typesafe environment variable validation with auto-coercion and Vite plugin. Use when defining schemas, validating data, transforming input, building type-safe APIs with ArkType, or validating environment variables with ArkEnv.","user-invocable":false}},"renderedAt":1782979498909}

ArkType Validation Overview ArkType is a TypeScript-native runtime validation library that defines schemas using string expressions mirroring TypeScript syntax, providing editor autocomplete, syntax highlighting, and optimized validators. Use when building type-safe APIs, validating JSON payloads, or replacing Zod with a more TypeScript-idiomatic approach. Not suitable for projects that need Zod ecosystem compatibility or JSON Schema output. Package: Quick Reference | Pattern | Usage | | --------------------------------- | ----------------------------------------------- | | | Define object sc…