Zod

From InugamiDev/ultrathink-oss · View interactive version

Zod is an AI agent skill from the GitHub repository InugamiDev/ultrathink-oss. > TypeScript-first schema validation with static type inference.

How to use this skill

Skill file

Zod

TypeScript-first schema validation with static type inference.

When to Use

Core Patterns

Schema Definition

import { z } from "zod";

const UserSchema = z.object({
  name: z.string().min(1).max(100),
  email: z.string().email(),
  age: z.number().int().positive().optional(),
  role: z.enum(["admin", "user", "moderator"]),
  tags: z.array(z.string()).default([]),
});

type User = z.infer<typeof UserSchema>;

Validation

// parse() throws on failure, safeParse() returns result object
const result = UserSchema.safeParse(data);
if (!result.success) {
  console.log(result.error.flatten()); // { fieldErrors: { email: ["Invalid email"] } }
}

Common Combinators

Integration

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.