This skill provides Zod 4 validation patterns and conventions for the fitness app. Use when writing validation schemas, working with ISO dates, or validating API inputs.
Provides Zod 4 validation patterns for ISO dates, UUIDs, and API inputs.
/plugin marketplace add josephanson/claude-plugin/plugin install ja@josephansonThis skill inherits all available tools. When active, it can use any tool Claude has access to.
This skill documents Zod 4 validation patterns for the fitness app.
This project uses Zod 4 (zod@^4.0.0). Zod 4 introduced several new APIs and syntax changes.
Zod 4 introduces z.iso namespace for ISO 8601 format validation:
// Datetime (ISO 8601)
z.iso.datetime() // "2020-01-01T06:15:00Z"
z.iso.datetime({ offset: true }) // "2020-01-01T06:15:00+02:00"
z.iso.datetime({ local: true }) // "2020-01-01T06:15:01" (no timezone)
z.iso.datetime({ precision: 3 }) // milliseconds required
// Date only
z.iso.date() // "2020-01-01"
// Time only
z.iso.time() // "06:15:00"
z.iso.time({ precision: 3 }) // "06:15:00.123"
// Duration
z.iso.duration() // "P3Y6M4DT12H30M5S"
// With custom message
z.iso.datetime({ message: 'Invalid date format' })
// With multiple options
z.iso.datetime({
offset: true,
message: 'Date must include timezone offset'
})
z.uuid() // Any valid UUID
z.uuid({ version: 4 }) // UUID v4 only
z.uuid({ message: 'Invalid ID' }) // Custom error
// Optional datetime
z.iso.datetime().optional()
// Nullable datetime
z.iso.datetime().nullable()
// Both optional and nullable
z.iso.datetime().nullish()
// Transform to Date object
z.iso.datetime().transform(str => new Date(str))
/shared/schemas/*.ts - Reusable across client/server/shared/validations/*.ts - API input validationexport const analyticsQuerySchema = z.object({
period: z.enum(['7d', '30d', '90d', '1y', 'all']).optional(),
startDate: z.iso.datetime({ message: 'Invalid start date' }).optional(),
endDate: z.iso.datetime({ message: 'Invalid end date' }).optional(),
})
export const createChallengeSchema = z.object({
name: z.string().min(1).max(100),
startDate: z.iso.datetime({ message: 'Invalid start date' }),
endDate: z.iso.datetime({ message: 'Invalid end date' }),
}).refine(
(data) => new Date(data.endDate) > new Date(data.startDate),
{ message: 'End date must be after start date', path: ['endDate'] }
)
const paramsSchema = z.object({
id: z.uuid({ message: 'Invalid ID format' }),
})
| Zod 3 | Zod 4 |
|---|---|
z.string().datetime() | z.iso.datetime() |
z.string().date() | z.iso.date() |
z.string().time() | z.iso.time() |
z.string().uuid() | z.uuid() |
Use the project's validation helpers in API routes:
import { validateBody, validateParams, validateQuery } from '~~/server/utils/bodyValidation'
export default defineEventHandler(async (event) => {
const { id } = await validateParams(event, paramsSchema)
const body = await validateBody(event, bodySchema)
const query = await validateQuery(event, querySchema)
})
Activates when the user asks about AI prompts, needs prompt templates, wants to search for prompts, or mentions prompts.chat. Use for discovering, retrieving, and improving prompts.
Search, retrieve, and install Agent Skills from the prompts.chat registry using MCP tools. Use when the user asks to find skills, browse skill catalogs, install a skill for Claude, or extend Claude's capabilities with reusable AI agent components.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.