apps/docs/skills/zod-to-form/SKILL.md
Use when working with zod-to-form (core, react, cli, codegen, vite).
npx skillsauth add pradeepmouli/zod-to-form zod-to-formInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill for ANY work with zod-to-form. It routes to the correct package.
Use this router when:
zod-to-form-corezod-to-form-reactzod-to-form-clizod-to-form-codegenzod-to-form-vitezod-to-form-coreRequires Zod v4 — uses _zod.def, _zod.bag, and z.registry() APIs.
Does NOT work with Zod v3 (which uses _def internals).
defineConfig is the typed entry point; bare object literals lose generic inference on components.overridesKey APIs: canonicalizeConfig, createOptimizers, createSchemaLiteCollector
zod-to-form-reactChoose your abstraction level: <ZodForm> for zero-config, useZodForm for custom
rendering, manual walkSchema for full control. Each step down trades convenience for
flexibility.
<ZodForm> and the CLI share the same walkSchema output so the migration is mechanicalform instance (e.g. to call form.setValue)Key APIs: ZodForm, useZodForm, useExternalSync
zod-to-form-cliBefore using the CLI, decide: are you scripting (use runGenerate) or interacting
(use npx zod-to-form)? For config authoring, always use defineConfig for type inference.
dryRun output for preview/diffing without touching the filesystemKey APIs: runGenerate, createProgram, defineConfig
zod-to-form-codegenFormField[] and needs the TSX stringKey APIs: generateFormComponent, resolveFieldMapping, getFileHeader
zod-to-form-viteTwo modes: ?z2f query imports (transform per-import, HMR works) vs generate mode
(static JSX rewriting, no HMR integration). Use ?z2f for new forms, generate for
migrating existing <ZodForm> call sites.
import SignupForm from './signup.schema?z2f' to Just Work in a Vite app — the plugin intercepts the import and compiles the form on demand<ZodForm> call sites — opt in via generate: {} in plugin optionsKey APIs: Z2FViteError, z2fVite, formatZ2FViteError
Top pitfall per package:
componentConfig without a matching components map that covers the component names referenced — missing components are silently dropped at render time with no console error; add each name to components or use defaultComponentMap as the base (react)result.code as the on-disk file content when overwrite is false — if the output file already exists, runGenerate returns wroteFile: false and the existing file is unchanged without throwing; FIX: check result.wroteFile before assuming the file was updated, or set defaults.overwrite: true explicitly (cli)generateFormComponent with a stale fields array from a previous schema version — there is no cache invalidation; callers must re-run walkSchema on schema change (codegen)?z2f on schemas with cyclic type references — the schema walker recurses on Zod's internal type graph and hangs with no error or timeout; FIX: break cycles with z.lazy() before using the ?z2f import (vite)| Thought | Reality |
|---------|---------|
| "I'll just use core for everything" | core is for documentation site for zod-to-form (docusaurus 3 + typedoc). You only need whole-schema validation — omit the optimization option entirely |
| "I'll just use react for everything" | react is for documentation site for zod-to-form (docusaurus 3 + typedoc). Bundle size is critical — use CLI codegen (@zod-to-form/cli) instead; runtime schema walking includes the full Zod type graph traversal, which does not tree-shake |
| "I'll just use cli for everything" | cli is for documentation site for zod-to-form (docusaurus 3 + typedoc). Interactive use — run npx zod-to-form generate (via createProgram()) instead |
| "I'll just use codegen for everything" | codegen is for documentation site for zod-to-form (docusaurus 3 + typedoc). You want file-writing behavior — use runGenerate() from @zod-to-form/cli instead |
| "I'll just use vite for everything" | vite is for documentation site for zod-to-form (docusaurus 3 + typedoc). You are building with webpack, esbuild, Rollup, or any non-Vite bundler — use @zod-to-form/cli instead |
User: "I need to documentation site for zod-to-form (docusaurus 3 + typedoc)"
→ Load zod-to-form-core
User: "I need to documentation site for zod-to-form (docusaurus 3 + typedoc)"
→ Load zod-to-form-react
User: "I need to documentation site for zod-to-form (docusaurus 3 + typedoc)"
→ Load zod-to-form-cli
User: "I need to documentation site for zod-to-form (docusaurus 3 + typedoc)"
→ Load zod-to-form-codegen
User: "I need to documentation site for zod-to-form (docusaurus 3 + typedoc)"
→ Load zod-to-form-vite
tools
Vite plugin for zod-to-form — transforms ?z2f imports into generated form components and optionally replaces <ZodForm> JSX call sites with generated components at build time Use when: You want `import SignupForm from './signup.schema?z2f'` to Just Work in a.... Also: vite, vite-plugin, zod, zod-v4, codegen, forms, form-generation, schema-driven, react-hook-form, build-plugin, jsx-transform.
development
Runtime <ZodForm> renderer for Zod v4 schemas Use when: You need form rendering in storybook, playgrounds, or low-traffic admin UIs —.... Also: zod, zod-v4, react, forms, form-generation, react-hook-form, schema-driven, dynamic-forms, form-renderer, hookform-resolver, zod-form-renderer.
development
Schema walker and processor registry for Zod v4 form generation Use when: You want per-field validation instead of whole-form validation. Also: zod, zod-v4, forms, form-generation, schema, schema-walker, processor-registry, react-hook-form, schema-driven, form-schema, zod-registry.
development
Browser-safe code generation for Zod v4 form components Use when: Building a custom codegen pipeline that assembles `FormField[]` and needs the.... Also: zod, zod-v4, codegen, forms, form-generation, react-hook-form, schema-driven, template-generation, browser-safe, component-codegen, schema-to-tsx.