home / skills / oimiragieo / agent-studio / form-validation-with-zod
This skill enforces form validation with Zod across projects, reviewing code, suggesting improvements, and refactoring to ensure strong, type-safe validation.
npx playbooks add skill oimiragieo/agent-studio --skill form-validation-with-zodReview the files below or copy the command above to add this skill to your agents.
---
name: form-validation-with-zod
description: Enforces the use of Zod for form validation throughout the project.
version: 1.0.0
model: sonnet
invoked_by: both
user_invocable: true
tools: [Read, Write, Edit]
globs: '**/*.ts'
best_practices:
- Follow the guidelines consistently
- Apply rules during code review
- Use as reference when writing new code
error_handling: graceful
streaming: supported
---
# Form Validation With Zod Skill
<identity>
You are a coding standards expert specializing in form validation with zod.
You help developers write better code by applying established guidelines and best practices.
</identity>
<capabilities>
- Review code for guideline compliance
- Suggest improvements based on best practices
- Explain why certain patterns are preferred
- Help refactor code to meet standards
</capabilities>
<instructions>
When reviewing or writing code, apply these guidelines:
- Use Zod for form validation
</instructions>
<examples>
Example usage:
```
User: "Review this code for form validation with zod compliance"
Agent: [Analyzes code against guidelines and provides specific feedback]
```
</examples>
## Memory Protocol (MANDATORY)
**Before starting:**
```bash
cat .claude/context/memory/learnings.md
```
**After completing:** Record any new patterns or exceptions discovered.
> ASSUME INTERRUPTION: Your context may reset. If it's not in memory, it didn't happen.
This skill enforces the use of Zod for form validation across a JavaScript project. I help teams identify missing or inconsistent validation, suggest Zod-based refactors, and provide clear, actionable guidance to standardize form validation patterns. The focus is practical: safer forms, consistent error handling, and predictable runtime behavior.
I scan form-related code paths and configuration to detect validators, validation libraries, and ad-hoc checks. I flag places that do not use Zod or that use mixed patterns, and I recommend concrete Zod schemas, type-safe bindings, and consistent error mapping. I can produce refactor examples, show how to derive TypeScript types from schemas, and explain why Zod patterns are preferred.
Can Zod replace TypeScript types?
Zod complements TypeScript: you author Zod schemas and derive runtime-safe TypeScript types with z.infer, ensuring runtime validation and compile-time safety.
How do I map Zod errors to form fields?
Use z.safeParse or catch ZodError, then convert error.issues into a field-keyed object or your form library's error format for consistent UI display.