balligh-insage/claida-zod-assistant icon
public
Published on 3/6/2025
Claida ZOD Assistant

Claida ZOD Assitant

Rules
Models
Context
mistral Codestral model icon

Codestral

mistral

voyage voyage-code-3 model icon

voyage-code-3

voyage

voyage Voyage AI rerank-2 model icon

Voyage AI rerank-2

voyage

anthropic Claude 3.7 Sonnet model icon

Claude 3.7 Sonnet

anthropic

200kinput·8.192koutput
openai OpenAI GPT-4o model icon

OpenAI GPT-4o

OpenAI

128kinput·16.384koutput
openai o3-mini model icon

o3-mini

OpenAI

200kinput·100koutput
openai OpenAI GPT-4o Mini model icon

OpenAI GPT-4o Mini

OpenAI

128kinput·16.384koutput
- Always define schemas using Zod primitives (e.g., z.string(), z.number()).
- For nested data, use z.object() or z.array().
- Enforce clear, strict validation in your schemas.
- Avoid "any"-like constructs in schema definitions.
- Design each schema around a specific data domain (e.g., userSchema, formSchema).
- Mark optional fields with .optional() instead of unioning with undefined or null.
- For default values, use .default(value).
- Use Zod for runtime checks and static TypeScript types with z.infer.
- Always parse or refine data before usage in your app's logic or components.
- For asynchronous or transformed validations, use .transform() or .superRefine().
- Keep transformations minimal to avoid confusion between parse-time changes and original data shape.
- Break large schemas into smaller, composable pieces.
- Import shared schemas or define extended variants with .extend() for clarity.
- Catch parsing errors gracefully. Always handle or log ZodError messages for user-friendly feedback.
- Only use z.unknown() or z.any() if absolutely necessary and justified.
- Prefer narrower schemas for type safety.
- In client components, parse form data with parse() or safeParse() for immediate user feedback.
- In server actions or APIs, always validate incoming data with parse() before proceeding.
- Validate only at critical boundaries (API endpoints, form submission) to avoid redundant checks.
- Memoize or reuse schemas if needed in performance-critical code.
- Write unit tests for complex validations, especially with refinements or transforms.
- Ensure coverage for edge cases, optional fields, or async validations.
Zodhttps://zod.dev/

Prompts

Learn more

No Prompts configured

Context

Learn more
@diff
Reference all of the changes you've made to your current branch
@codebase
Reference the most relevant snippets from your codebase
@url
Reference the markdown converted contents of a given URL
@folder
Uses the same retrieval mechanism as @Codebase, but only on a single folder
@terminal
Reference the last command you ran in your IDE's terminal and its output
@code
Reference specific functions or classes from throughout your project
@file
Reference any file in your current workspace

No Data configured

MCP Servers

Learn more

No MCP Servers configured