anivar

Zod Skill — AI skill for Claude Code

AI community

AI agent skill for Zod 4 and Zod 3 — 30 rules with their Zod 3 forms: schema design, parsing, error handling, type inference.

How to install Zod Skill

This entry records only its repository, not the path inside it, so there is no exact command to give. Open anivar/zod-skill and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Zod Skill does

AI agent skill for Zod 4 and Zod 3 — 30 rules with their Zod 3 forms: schema design, parsing, error handling, type inference. Works with Claude Code, Cursor, Codex, Windsurf.

Alternatives in AI

  • Styleseed — Claude Code & Cursor design system 325 ★
  • Glade MCP — Connect any MCP-compatible AI client (Claude Code, Cursor, Windsurf) to Unity or Godot 201 ★
  • Awareness Local — Local-first AI agent memory — one command, works offline, no account needed 199 ★

README

Zod Skill

Created by **[Anivar Aravind](https://anivar.net)**

An AI agent skill for writing, validating, and debugging Zod schemas with modern best practices, for Zod 4 and for projects still on Zod 3.

The Problem

AI agents often generate outdated Zod v3 patterns in Zod 4 projects — `z.string().email()` instead of `z.email()`, `z.nativeEnum()` instead of the unified `z.enum()`, `required_error` instead of the `error` parameter — and miss critical parsing pitfalls like using `parse()` instead of `safeParse()`, forgetting `parseAsync` for async refinements, or assuming `z.object()` preserves unknown keys. Some of these no longer compile, some are deprecated, and some compile but misbehave at runtime. The reverse failure is as common: a Zod 4 skill loaded into a Zod 3 project makes the agent write `z.email()`, `error:` and `z.flattenError()` into a codebase where none of them exist.

This Solution

30 rules with incorrect→correct code examples that teach agents Zod 4's actual API behavior, schema design patterns, error handling, architectural placement, observability, and TypeScript integration. Each rule targets a specific mistake and shows exactly how to fix it. The skill first tells the agent to establish which Zod a file uses, from the import specifier and the installed version; for a Zod 3 file, 27 Zod 3 rule files under `v3/rules/` give the Zod 3 form of each rule whose code differs, and `v3/references/zod-3.md` maps the rest.

Install

npx skills add anivar/zod-skill -g

Testing schemas is covered too, in `references/testing.md`. The [zod-testing](https://github.com/anivar/zod-testing) skill carries the same guide, generated from these files by `.github/check/sync-testing.ts`.

Or with full URL:

npx skills add https://github.com/anivar/zod-skill

Baseline

  • zod ^4.6.0, checked against zod 4.6.7 and the zod.dev pages
  • zod ^3.25.0 for Zod 3 files, checked against zod 3.25.76 (the last Zod 3 release line) and the zod.dev