Skip to content
Agentmart
Submit a tool

zod-4

Zod 4 schema validation patterns.

Skill by prowler-cloud

IndexedApache-2.0
Write a review

Chalk Labs

Need help deploying zod-4?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code. Read the repository before you give any tool access to your data.

npx agentmarket install skill/vab1997-zod-4

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Zod 4 schema validation patterns. Trigger: When creating or updating Zod v4 schemas for validation/parsing (forms, request payloads, adapters), including v3 -> v4 migration patterns.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/zod-4

Tools it pre-approves 9

From allowed-tools in SKILL.md: the agent may use these without asking you each time.

  • Read,
  • Edit,
  • Write,
  • Glob,
  • Grep,
  • Bash,
  • WebFetch,
  • WebSearch,
  • Task

What's inside

Skill name
zod-4
Description
Zod 4 schema validation patterns. Trigger: When creating or updating Zod v4 schemas for validation/parsing (forms, request payloads, adapters), including v3 -> v4 migration patterns.
License
Apache-2.0
Allowed tools
Read,, Edit,, Write,, Glob,, Grep,, Bash,, WebFetch,, WebSearch,, Task
Metadata
author: prowler-cloud · version: 1.0 · auto_invoke: Creating Zod schemas
Instructions
207 lines in SKILL.md · view on GitHub

Before installing

  • Pre-approves some shell commands

Files (1)

  • SKILL.md

SKILL.md (first lines)

## Breaking Changes from Zod 3

```typescript
// ❌ Zod 3 (OLD)
z.string().email()
z.string().uuid()
z.string().url()
z.string().nonempty()
z.object({ name: z.string() }).required_error('Required')

// ✅ Zod 4 (NEW)
z.email()
z.uuid()
z.url()
z.string().min(1)
z.object({ name: z.string() }, { error: 'Required' })
```

## Basic Schemas

```typescript
import { z } from 'zod'

// Primitives
const stringSchema = z.string()
const numberSchema = z.number()
const booleanSchema = z.boolean()
const dateSchema = z.date()

// Top-level validators (Zod 4)
const emailSchema = z.email()
const uuidSchema = z.uuid()
const urlSchema = z.url()

// With constraints
const nameSchema = z.string().min(1).max(100)
const ageSchema = z.number().int().positive().max(150)
const priceSchema = z.number().min(0).multipleOf(0.01)
```

## Object Schemas

```typescript
const userSchema = z.object({
  id: z.uuid(),
  email: z.email({ error: 'Invalid email address' }),
  name: z.string().min(1, { error: 'Name is required' }),
  age: z.number().int().positive().optional(),
  role: z.enum(['admin', 'user', 'guest']),
  metadata: z.record(z.string(), z.unknown()).optional(),
})

type User = z.infer<typeof userSchema>

// Parsing
const user = userSchema.parse(data) // Throws on error
const result = userSchema.safeParse(data) // Returns { success, data/error }

if (result.success) {
  console.log(result.data)
} else {
  console.log(result.error.issues)
}
```

## Arrays and Records

```typescript
// Arrays
const tagsSchema = z.array(z.string()).min(1).max(10)
const numbersSchema = z.array(z.number()).nonempty()

// Records (objects with dynamic keys)
const scoresSchema = z.record(z.string(), z.number())
// { [key: string]: number }

// Tuples
const coordinatesSchema = z.tuple([z.number(), z.number()])
// [number, number]
```

## Unions and Discriminated Unions

```typescript
// Simple union
const stringOrNumber = z.union([z.string(), z.number()])

// Discriminated union (more efficient)
const resultSchema = z.discriminatedUnion('status', [
  z.object({ status: z.literal('success'), data: z.unknown() }),
  z.object({ status: z.literal('error'), error: z.string() }),
])
```

## Transformations

```typescript
// Transform during parsing
const lowercaseEmail = z.email().transform((email) => email.toLowerCase())

// Coercion (convert types)
const numberFromString = z.coerce.number() // "42" → 42
const dateFromString = z.coerce.date() // "2024-01-01" → Date

// Preprocessing
const trimmedString = z.preprocess(
  (val) => (typeof val === 'string' ? val.trim() : val),
  z.string(),
)
```

## Refinements

```typescript
const passwordSchema = z
  .string()
  .min(8)
  .refine((val) => /[A-Z]/.test(val), {
    message: 'Must contain uppercase letter',

From vab1997/mecania-assistant, Apache-2.0.

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Jan 23, 2026 (9 months ago)

From GitHub (fetched Oct 24, 2026).

Details

Version
1.0
License
Apache-2.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from prowler-cloud

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get zod-4 running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying zod-4?

CallGet help
Cite this page

zod-4 skill. Agent Mart. https://agentmart.dev/skills/vab1997-zod-4 (last updated 2026-10-24)