zod-v4 — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited zod-v4 (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Version: 4.x Docs: https://zod.dev
See reference.md for the full API (imports, types, parsing, schema manipulation, error handling, common patterns).
// v4: produces { a: number; b: number } (both required)
z.record(z.enum(['a', 'b']), z.number())
// For optional keys, use z.partialRecord()
z.partialRecord(z.enum(['a', 'b']), z.number()) // { a?: number; b?: number }message, invalid_type_error, required_error removed // v3
z.string({ required_error: 'Required', invalid_type_error: 'Must be string' })
// v4
z.string({ error: (iss) => iss.input === undefined ? 'Required' : 'Must be string' }).default() must match output type (use .prefault() for pre-parse defaults)ZodError.issues instead| Method | Type | Use When | ||
|---|---|---|---|---|
.optional() | `T \ | undefined` | Field can be absent | |
.nullable() | `T \ | null` | Field uses null as empty | |
.nullish() | `T \ | null \ | undefined` | Messy external data |
Don't chain .optional().nullable() — use .nullish()
z.interface({ "name?": z.string() }) // { name?: string } — key may be omitted
z.interface({ name: z.string().optional() }) // { name: string | undefined } — key requiredz.discriminatedUnion() over z.union() for object schemas.unknown() forces type narrowingresult.success.transform() for conversion, .refine() for validationfalse, Zod handles errorsz.discriminatedUnion()z.infer<typeof schema>.nullish()~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.