arktype
Skill2 starsChanged 10 months agoMITView on GitHub
Runtime TypeScript validation library with 1:1 type syntax. Use when creating validators, parsing data, or working with ArkType schema definitions using type().
- Installs packages
4 other projects use a version of this.
Adopted by
Most recently taken up by
- epicenter-md/epicentertheir own version, first seen Oct 8, 2026
- EpicenterHQ/epicentertheir own version, first seen Oct 8, 2026
- Robot-Inventor/agent-skillstheir own version, first seen Aug 14, 2026
- lobomfz/skillstheir own version, first seen Apr 28, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- epicenter-md/epicenter★ 4.8ksame name
- EpicenterHQ/epicenter★ 4.8ksame name
- Robot-Inventor/agent-skills★ 3same name
- lobomfz/skills★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Files
ArkType
Runtime validation with TypeScript-like syntax. 100x faster than Zod.
Installation
npm install arktypeRequires TypeScript >=5.1, "type": "module" in package.json, and strict or strictNullChecks in tsconfig.
Core Syntax
import { type } from "arktype";
const User = type({
name: "string",
email: "string.email",
"age?": "number >= 0", // optional with constraint
role: "'admin' | 'user'", // literal union
tags: "string[]", // array
});
type User = typeof User.infer; // extract TS type
// Validation
const result = User(inputData);
if (result instanceof type.errors) {
console.error(result.summary); // human-readable errors
} else {
console.log(result.name); // narrowed to User
}String Keywords
Primitives: string, number, boolean, bigint, symbol, null, undefined, object, unknown, never
String subtypes: string.email, string.uuid, string.uuid.v4, string.url, string.json, string.json.parse (morph), string.numeric, string.numeric.parse (morph), string.integer, string.date, string.date.parse (morph), string.semver, string.ip, string.base64, string.trim (morph), string.lower (morph), string.upper (morph)
Number subtypes: number.integer, number.positive, number.negative, number.safe, number.epoch
Instanceof: Date, Error, RegExp, Map, Set, Promise, Array, FormData, File, Blob
Constraints
// Numbers
"number > 0"; // exclusive min
"number >= 0"; // inclusive min
"0 < number <= 100"; // range
"number % 2"; // divisible by
// Strings (length)
"string > 0"; // non-empty
"1 <= string <= 50"; // length range
// Arrays (length)
"string[] > 0"; // non-empty array
// Dates
"Date > d'2000-01-01'"; // after date literal
// Regex
"/^[a-z]+$/"; // patternObjects
type({
required: "string",
"optional?": "number", // optional
withDefault: "string = 'hi'", // default value
"[string]": "unknown", // index signature
"+": "reject", // error on undeclared keys (or "delete" to strip)
});
// Merge objects
const Extended = Base.merge({ extra: "string" });
// or: type({ "...": Base, extra: "string" })Arrays & Tuples
"string[]"[("string", "number")][("string", "number?")][ // array // tuple // optional element
("string", "...", "number[]")
][("string", "boolean = false")]; // variadic // defaultableUnions & Intersections
"string | number"; // union
"string & /^a/"; // intersection
type.string.or(type.number); // fluentMorphs (Transforms)
// Built-in
"string.json.parse"; // string → object
"string.numeric.parse"; // "123" → 123
// Custom
const trimmed = type("string").pipe((s) => s.trim());
// Chain with output validation
type("string.json.parse").to({ name: "string" });Narrow (Custom Validation)
const even = type("number").narrow(
(n, ctx) => n % 2 === 0 || ctx.mustBe("even"),
);Generics
// Built-in
"Record<string, number>";
"Pick<User, 'name'>";
"Partial<User>";
// Custom
const boxOf = type("<t>", { box: "t" });
const stringBox = boxOf("string");Scopes (Reusable Aliases)
import { scope } from "arktype";
const types = scope({
Id: "string.uuid",
User: { id: "Id", friends: "User[]" }, // cyclic OK
}).export();
// Shorthand
const types = type.module({
User: { name: "string" },
Admin: { "...": "User", isAdmin: "true" },
});Error Handling
if (result instanceof type.errors) {
result.summary; // "name must be a string (was number)"
result.throw(); // throw as exception
for (const error of result) {
error.path; // ["users", 0, "name"]
error.expected; // "a string"
error.actual; // "a number"
}
}Common Patterns
// API Response discriminated union
const ApiResponse = type({
success: "true",
data: "unknown",
}).or({
success: "false",
error: "string",
});
// Form with defaults
const Form = type({
email: "string.email",
password: "string >= 8",
"remember?": "boolean = false",
});References
- Keyword Table - Complete keyword and fluent method tables
- Advanced Usage - Advanced features (match, configuration, introspection)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

