Skip to content
Back to skills

Zod

ASecurity

Zod — schema validation, type inference, parsing, refinement, transforms, integration.

  • 47 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added September 12, 2026
toolsreactapi

Works with

  • api

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add skeletorflet/opencode-supreme-setup --skill zod --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Zod?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Zod
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/skeletorflet-zod/badge)](https://www.skillsdirectory.com/skills/skeletorflet-zod)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: zod
description: Zod — schema validation, type inference, parsing, refinement, transforms, integration.
---

## zod

### Schema Definitions
- Primitives: `z.string()`, `z.number()`, `z.boolean()`, `z.bigint()`, `z.date()`, `z.null()`, `z.undefined()`.
- Objects: `z.object({ name: z.string() })` — nested, optional `.optional()`, nullable `.nullable()`.
- Arrays/Tuples: `z.array(z.string())`, `z.tuple([z.string(), z.number()])`.
- Unions/Discriminated: `z.union([...])`, `z.discriminatedUnion('type', [...])` for tagged unions.
- Literal/Enum: `z.literal('foo')`, `z.enum(['A', 'B'])`, `z.nativeEnum(ColorEnum)`.

### Type Inference
- `z.infer<typeof schema>` — extract TS type from schema; `z.input<T>` / `z.output<T>` for input/output variants.
- `z.ZodType<T>` — class generic for extending or wrapping schemas.

### Parsing
- `schema.parse(data)` — throws `ZodError` on failure; `schema.safeParse(data)` — returns `{ success, data, error }`.
- `schema.parseAsync(data)` / `schema.safeParseAsync(data)` for async refinements.
- Partial/deep partial: `schema.partial()`, `.deepPartial()`, `.pick({ k: true })`, `.omit({ k: true })`.

### Refinement & Transform
- `.refine((val) => val.length > 5, "too short")` — custom sync/async validation.
- `.superRefine((val, ctx) => { ctx.addIssue(...) })` — multi-issue additions.
- `.transform((val) => val.toUpperCase())` — post-parse value transformation.
- `.preprocess((val) => typeof val === 'string' ? JSON.parse(val) : val)` — pre-parse hooks.

### Integration
- React Hook Form: `zodResolver(z.object({...}))` from `@hookform/resolvers/zod`.
- tRPC: schemas as procedure input/output validators.
- OpenAPI generation via `zod-to-json-schema` or `@anatine/zod-openapi`.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.