Zod schema validation best practices for type safety, parsing, and error handling.

GPL-3.0Auto-check passedDevelopment

Install Zod

skills CLI
$ npx skills add jasonjgardner/blockbench-mcp-plugin --skill zod -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jasonjgardner/blockbench-mcp-plugin zod --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jasonjgardner/blockbench-mcp-plugin.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/zod .claude/skills/zod && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
zod
GitHub stars
495
Used in
3 other repos
Token cost
~1.4k tokens
SKILL.md length
511 words
Files
45 (incl. references)
Skills in repo
2
Repo updated
First seen
Licence
GPL-3.0

At a glance

Zod schema validation best practices for type safety, parsing, and error handling.

  • Works in 8 steps: Schema Definition (CRITICAL) → Parsing & Validation (CRITICAL) → Type Inference (HIGH) → …
  • Tasks that involve Forms and validation
  • SKILL.md covers When to Apply, Rule Categories by Priority, Quick Reference and How to Use, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Zod is an agent skill from jasonjgardner/blockbench-mcp-plugin. Zod schema validation best practices for type safety, parsing, and error handling. This skill should be used when defining z.object schemas, using z.string validations, safeParse, or z.infer. This skill does NOT cover React Hook Form integration patterns (use react-hook-form skill) or OpenAPI client generation (use orval skill).

Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 45 other files, including reference files (for example `AGENTS.md`, `references/compose-intersection.md` and `references/compose-lazy-recursive.md`).

It sits in Development, covering Forms and validation, React components and Type safety. It works with Zod, OpenAPI and Model Context Protocol. The repository describes itself as: Adds MCP server to Blockbench. The licence is GPL-3.0.

When your agent uses it

  • Tasks that involve Forms and validation
  • Tasks that involve React components
  • Tasks that involve Type safety

Example prompts

  • “/zod”

Workflow steps

8 steps, taken from the step headings in SKILL.md.

  1. Schema Definition (CRITICAL)
  2. Parsing & Validation (CRITICAL)
  3. Type Inference (HIGH)
  4. Error Handling (HIGH)
  5. Object Schemas (MEDIUM-HIGH)
  6. Schema Composition (MEDIUM)
  7. Refinements & Transforms (MEDIUM)
  8. Performance & Bundle (LOW-MEDIUM)

What it can do on your machine

Read from SKILL.md and the folder at commit d027171. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • zod.dev
    • github.com
    • totaltypescript.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Zod loads about 1.4k tokens when it runs, and up to ~37k if it reads all its reference files. Until then it costs about 84 tokens; SKILL.md has 511 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~84
When it runs · the whole SKILL.md, loaded when a task matches
~1.4k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~37k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jasonjgardner/blockbench-mcp-plugin at commit d027171, republished under its GPL-3.0 licence (© jasonjgardner). 511 words, ~1,365 tokens.

Download SKILL.mdSave it as .claude/skills/zod/SKILL.md (or your agent's skills folder). This skill also uses 44 other files; get the full folder from GitHub.
name
zod
description
Zod schema validation best practices for type safety, parsing, and error handling. This skill should be used when defining z.object schemas, using z.string validations, safeParse, or z.infer. This skill does NOT cover React Hook Form integration patterns (use react-hook-form skill) or OpenAPI client generation (use orval skill).

Zod Best Practices

Comprehensive schema validation guide for Zod in TypeScript applications. Contains 43 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.

When to Apply

Reference these guidelines when:

  • Writing new Zod schemas
  • Choosing between parse() and safeParse()
  • Implementing type inference with z.infer
  • Handling validation errors for user feedback
  • Composing complex object schemas
  • Using refinements and transforms
  • Optimizing bundle size and validation performance
  • Reviewing Zod code for best practices

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Schema DefinitionCRITICALschema-
2Parsing & ValidationCRITICALparse-
3Type InferenceHIGHtype-
4Error HandlingHIGHerror-
5Object SchemasMEDIUM-HIGHobject-
6Schema CompositionMEDIUMcompose-
7Refinements & TransformsMEDIUMrefine-
8Performance & BundleLOW-MEDIUMperf-

Quick Reference

1. Schema Definition (CRITICAL)
  • schema-use-primitives-correctly - Use correct primitive schemas for each type
  • schema-use-unknown-not-any - Use z.unknown() instead of z.any() for type safety
  • schema-avoid-optional-abuse - Avoid overusing optional fields
  • schema-string-validations - Apply string validations at schema definition
  • schema-use-enums - Use enums for fixed string values
  • schema-coercion-for-form-data - Use coercion for form and query data
2. Parsing & Validation (CRITICAL)
  • parse-use-safeparse - Use safeParse() for user input
  • parse-async-for-async-refinements - Use parseAsync for async refinements
  • parse-handle-all-issues - Handle all validation issues not just first
  • parse-validate-early - Validate at system boundaries
  • parse-avoid-double-validation - Avoid validating same data twice
  • parse-never-trust-json - Never trust JSON.parse output
3. Type Inference (HIGH)
  • type-use-z-infer - Use z.infer instead of manual types
  • type-input-vs-output - Distinguish z.input from z.infer for transforms
  • type-export-schemas-and-types - Export both schemas and inferred types
  • type-branded-types - Use branded types for domain safety
  • type-enable-strict-mode - Enable TypeScript strict mode
4. Error Handling (HIGH)
  • error-custom-messages - Provide custom error messages
  • error-use-flatten - Use flatten() for form error display
  • error-path-for-nested - Use issue.path for nested error location
  • error-i18n - Implement internationalized error messages
  • error-avoid-throwing-in-refine - Return false instead of throwing in refine
Show full SKILL.md (225 more words)Show less
5. Object Schemas (MEDIUM-HIGH)
  • object-strict-vs-strip - Choose strict() vs strip() for unknown keys
  • object-partial-for-updates - Use partial() for update schemas
  • object-pick-omit - Use pick() and omit() for schema variants
  • object-extend-for-composition - Use extend() for adding fields
  • object-optional-vs-nullable - Distinguish optional() from nullable()
  • object-discriminated-unions - Use discriminated unions for type narrowing
6. Schema Composition (MEDIUM)
  • compose-shared-schemas - Extract shared schemas into reusable modules
  • compose-intersection - Use intersection() for type combinations
  • compose-lazy-recursive - Use z.lazy() for recursive schemas
  • compose-preprocess - Use preprocess() for data normalization
  • compose-pipe - Use pipe() for multi-stage validation
7. Refinements & Transforms (MEDIUM)
  • refine-vs-superrefine - Choose refine() vs superRefine() correctly
  • refine-transform-coerce - Distinguish transform() from refine() and coerce()
  • refine-add-path - Add path to refinement errors
  • refine-defaults - Use default() for optional fields with defaults
  • refine-catch - Use catch() for fault-tolerant parsing
8. Performance & Bundle (LOW-MEDIUM)
  • perf-cache-schemas - Cache schema instances
  • perf-zod-mini - Use Zod Mini for bundle-sensitive applications
  • perf-avoid-dynamic-creation - Avoid dynamic schema creation in hot paths
  • perf-lazy-loading - Lazy load large schemas
  • perf-arrays - Optimize large array validation

How to Use

Read individual reference files for detailed explanations and code examples:

Full Compiled Document

For the complete guide with all rules expanded: AGENTS.md

  • For React Hook Form integration, see react-hook-form skill
  • For API client generation, see orval skill

Sources

© jasonjgardner, GPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 44 other files (references) in .agents/skills/zod of jasonjgardner/blockbench-mcp-plugin.

  • SKILL.md
  • AGENTS.md
  • references/compose-intersection.md
  • references/compose-lazy-recursive.md
  • references/compose-pipe.md
  • references/compose-preprocess.md
  • references/compose-shared-schemas.md
  • references/error-avoid-throwing-in-refine.md
  • references/error-custom-messages.md
  • references/error-i18n.md
  • references/error-path-for-nested.md
  • references/error-use-flatten.md
  • references/object-discriminated-unions.md
  • references/object-extend-for-composition.md
  • references/object-optional-vs-nullable.md
  • references/object-partial-for-updates.md
  • references/object-pick-omit.md
  • references/object-strict-vs-strip.md
  • references/parse-async-for-async-refinements.md
  • references/parse-avoid-double-validation.md
  • … and 25 more

Open the folder on GitHubat commit d027171

Used in 3 other repositories

We found 3 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 3 other GitHub owners. This page covers the copy in jasonjgardner/blockbench-mcp-plugin, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Zod next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Zod compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Zod this skilljasonjgardner/blockbench-mcp-plugin4953 repos~1.4kAutomated safety check: PassGPL-3.0
Type Safetyidavidov13/agentic-playwright225—~3.5kAutomated safety check: PassMIT
Manage Dashboard WidgetsPostHog/posthog40k—~2.3kAutomated safety check: PassCustom licence
Typescript Patternssoftspark/ai-toolkit179—~1.6kAutomated safety check: PassApache-2.0
OpenAPI to MCP Servermcp-use/mcp-use11k—~5.2kAutomated safety check: PassApache-2.0
Dashclaw Shipucsandman/DashClaw310—~7.2kAutomated safety check: PassMIT

Similar skills

  • Type Safety

    idavidov13/agentic-playwright

    TypeScript type safety conventions for the Playwright scaffold — the "no any" rule, Zod 4 schema patterns (z.strictObject, top-level validators like z.uuid / z.email / z.url / z.int / z.enum)…

    225 GitHub stars~3.5k tokensUpdated yesterday
    Testing & QAAuto-check passed
  • Official

    Guides PostHog engineers through dashboard widget platform work — ship a new widgettype (WIDGETREGISTRY, catalog, runwidgets, WidgetCard) or update a shipped type (config, query, layout, RBAC, tile…

    40k GitHub stars~2.3k tokensUpdated today
    Backend & APIsAuto-check passed
  • Typescript Patterns

    softspark/ai-toolkit

    TypeScript types: generics, discriminated unions, Zod, satisfies, branded types.

    179 GitHub stars~1.6k tokensUpdated yesterday
    Frontend & DesignAuto-check passed
  • OpenAPI to MCP Server

    mcp-use/mcp-use

    Turns an OpenAPI or Swagger spec into an MCP server with the mcp-use TypeScript SDK, mapping each operation to a tool, wiring auth, testing and deploying.

    11k GitHub stars~5.2k tokensUpdated today
    Backend & APIsAuto-check passed
  • Dashclaw Ship

    ucsandman/DashClaw

    The single command that gets a DashClaw change ON MAIN AND LIVE — it resolves everything blocking production, never defers, and never hands back a checklist.

    310 GitHub stars~7.2k tokensUpdated 3 days ago
    DevelopmentAuto-check passed
  • API Integration

    MadAppGang/claude-code

    A skill your agent uses when integrating Apidog + OpenAPI specifications with your React app.

    285 GitHub stars~2.6k tokensUpdated 6 mo ago
    Backend & APIsAuto-check passed

More from jasonjgardner/blockbench-mcp-plugin

  • Blockbench Plugins

    jasonjgardner/blockbench-mcp-plugin

    Blockbench plugin/extension development for the 3D modeling tool.

    495 GitHub stars~2.8k tokensUpdated 7 days ago
    Auto-check passed

Questions about Zod

What does Zod do?

Zod schema validation best practices for type safety, parsing, and error handling. Zod is an agent skill from jasonjgardner/blockbench-mcp-plugin. Zod schema validation best practices for type safety, parsing, and error handling.

When should I use Zod?

Zod fits situations like: tasks that involve Forms and validation; tasks that involve React components; tasks that involve Type safety.

How do I install Zod in Claude Code?

Run `npx skills add jasonjgardner/blockbench-mcp-plugin --skill zod -a claude-code`. Or copy the skill folder (.agents/skills/zod in jasonjgardner/blockbench-mcp-plugin) into .claude/skills/zod in your project. Claude Code loads it when a task matches its description.

How do I install Zod in Codex?

Run `npx skills add jasonjgardner/blockbench-mcp-plugin --skill zod -a codex`. Or copy the skill folder (.agents/skills/zod in jasonjgardner/blockbench-mcp-plugin) into .agents/skills/zod in your project. Codex loads it when a task matches its description.

Can I use Zod in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jasonjgardner/blockbench-mcp-plugin --skill zod -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/zod, .gemini/skills/zod, .github/skills/zod and .opencode/skills/zod in your project.

What does Zod need to run?

SKILL.md names no scripts, command-line tools or credentials: Zod is instructions for the agent only.

Does Zod access the network?

SKILL.md names 3 domains. As links in the text: zod.dev, github.com and totaltypescript.com. This is read from the text; nothing was executed.

Is Zod safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Zod use?

Zod is published under the GPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Zod use?

About 1.4k tokens (SKILL.md is roughly 5.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 36k tokens, read only when the agent opens those files.

What are the alternatives to Zod?

Skills that share tags, products or a category with Zod: Type Safety (idavidov13/agentic-playwright, 225 stars), Manage Dashboard Widgets (PostHog/posthog, 40k stars), Typescript Patterns (softspark/ai-toolkit, 179 stars) and OpenAPI to MCP Server (mcp-use/mcp-use, 11k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Zod?

jasonjgardner (a GitHub user) maintains it in jasonjgardner/blockbench-mcp-plugin, which has 495 GitHub stars. The repository holds 2 skills in this directory. The repository was last updated on October 1, 2026.

Source: jasonjgardner/blockbench-mcp-plugin on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.