AI agent skill for Zod v4 — 27 rules: schema design, parsing, error handling, type inference. Works with Claude Code, Cursor, Codex, Windsurf.
# Zod Skill Created by **[Anivar Aravind](https://anivar.net)** An AI agent skill for writing, validating, and debugging Zod v4 schemas with modern best practices. ## The Problem AI agents often generate outdated Zod v3 patterns — `z.string().email()` instead of `z.email()`, `z.nativeEnum()` instead of `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. These produce schemas that compile but silently misbehave at runtime. ## This Solution 27 rules with incorrect→correct code examples that teach agents Zod v4'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. ## Install ```bash npx skills add anivar/zod-skill -g ``` Or with full URL: ```bash npx skills add https://github.com/anivar/zod-skill ``` ## Baseline - zod ^4.0.0 - TypeScript ^5.5 ## What's Inside ### 27 Rules Across 9 Categories | Priority | Category | Rules | Impact | |----------|----------|-------|--------| | 1 | Parsing & Type Safety | 3 | CRITICAL | | 2 | Schema Design | 4 | CRITICAL | | 3 | Refinements & Transforms | 3 | HIGH | | 4 | Error Handling | 3 | HIGH | | 5 | Performance & Composition | 3 | MEDIUM | | 6 | v4 Migration | 3 | MEDIUM | | 7 | Advanced Patterns | 3 | MEDIUM | | 8 | Architecture & Boundaries | 3 | CRITICAL/HIGH | | 9 | Observability | 2 | HIGH/MEDIUM | Each rule file contains: - Why it matters - Incorrect code with explanation - Correct code with explanation - Decision tables and additional context ### 9 Deep-Dive References | Reference | Covers | |-----------|--------| | `schema-types.md` | All primitives, string formats, numbers, enums, dates, files, JSON | | `parsing-and-inference.md` | parse, safeParse, parseAsync, z.infer, z.inpu
Agent that generates comprehensive documentation, API references, architecture diagrams, and developer onboarding guides from existing code.
Agent configuration for systematic bug investigation that traces issues from error logs through the codebase to root cause with suggested fixes.
Agent for integrating third-party APIs including SDK setup, type generation, error handling, retry logic, and rate limit management.
Cursor's built-in autonomous coding agent that can make multi-file edits, run terminal commands, search the codebase, and iteratively build features with minimal human intervention.
Cloud-based autonomous coding agent that runs in the background on remote sandboxed environments, handling complex multi-step tasks while you continue working.
Cursor's multi-file editing agent within Composer mode that can create, edit, and delete files across your entire project in a single conversation.