form-validation_skill

This skill helps you implement robust server-first form validation using Zod and Conform in Remix apps, ensuring type-safety and Polaris-ready UI.
  • HTML

6

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill toilahuongg/shopify-agents-kit --skill form-validation

  • SKILL.md19.7 KB

Overview

This skill provides form validation patterns for Remix applications using Zod schemas and the Conform library. It explains schema design, server- and optional client-side validation, Polaris component integration, and handling of nested, dynamic, and refined form rules. The guidance focuses on predictable, type-safe data flows and progressive enhancement.

How this skill works

Define Zod schemas to describe and validate form data and infer TypeScript types. Use Conform helpers (useForm, getInputProps, useFieldList) to wire fields to Remix actions; parseWithZod runs validation on the server and can run asynchronously for DB checks. Polaris inputs are bridged to Conform by syncing their value changes to underlying form controls so validation and accessibility remain intact.

When to use it

  • Building Remix forms that require strict type-safe validation and predictable server-first behavior
  • Integrating Shopify Polaris UI components while preserving form validation and progressive enhancement
  • Handling nested objects, addresses, or other structured data in forms
  • Implementing dynamic field lists such as product variants or tag arrays
  • Adding async validation that checks uniqueness or cross-field rules on the server

Best practices

  • Keep schemas small and composable: extract address, variant, or discount sub-schemas
  • Prefer server-first validation with parseWithZod, and enable lightweight client validation for UX
  • Return structured submission.reply() errors from actions so useForm can show them
  • Use superRefine for cross-field rules and async checks; mark parseWithZod async when needed
  • When using Polaris, dispatch native input events after updating component values so Conform picks up changes

Example use cases

  • Product creation form with title, description, price, status, tags and server-side validation
  • Discount creation form that enforces code format, value constraints, and uniqueness via async validation
  • Checkout shipping form with nested billing/shipping addresses and same-as-billing toggle
  • Product edit page using Polaris components wired to Conform for inline error display
  • Dynamic variants management where users add/remove SKU/price/inventory fieldsets

FAQ

You can add client-side checks for faster feedback but keep server validation with Zod to ensure data integrity and security.

How do I validate cross-field rules like date ranges?

Use schema.refine or superRefine to add cross-field validations and attach errors to specific paths.

How do Polaris components report errors?

Map Conform field.errors to the component's error prop and sync component changes to the underlying native input so Conform captures events.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
form-validation skill by toilahuongg/shopify-agents-kit | VeilStrat