new-input

Generate Zod input schemas for domain CRUD operations.

13|5|Updated May 18, 2024
One-click install
npx skills add https://github.com/techdiary-dev/techdiary.dev --skill new-input
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: new-input
Source: https://github.com/techdiary-dev/techdiary.dev/tree/main/.claude/skills/new-input
Command: npx skills add https://github.com/techdiary-dev/techdiary.dev --skill new-input

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Creating a consistent and reusable Zod input schema file for a domain, reducing boilerplate and errors when modeling domain data.

Core Features & Use Cases

  • Generate createDomainInput, updateDomainInput, and listDomainInput schemas in src/backend/services/inputs/<domain>.input.ts
  • Enforce parseAsync() usage, explicit optional/nullable fields, and transforms to normalize data
  • Support domain-specific enum fields and ID types with consistent naming conventions

Quick Start

Provide the domain name and required fields to generate the input schema.

Frequently Asked Questions about new-input

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate a Zod input schema for a domain in TypeScript?

Generating a Zod input schema for a domain requires providing the domain name and required fields. The process outputs createDomainInput, updateDomainInput, and listDomainInput schemas in a dedicated TypeScript file using proper Zod patterns.

What is the best way to structure create, update, and list validation schemas for a domain?

Structuring validation schemas for a domain involves separating create, update, and list inputs into distinct Zod objects. This enforces explicit optional and nullable fields, ensuring robust data validation and reducing boilerplate errors.

How do I handle enum fields and string IDs when scaffolding Zod schemas?

When scaffolding Zod schemas, handling enum fields and string IDs requires enforcing consistent naming conventions and specific Zod patterns. This ensures type safety and proper validation for domain-specific identifiers and enumerated values.

Do I need to use parseAsync for Zod domain input validation?

Yes, using parseAsync for Zod domain input validation is required. The generated schema enforces parseAsync usage alongside explicit domain transformation rules to properly normalize data and ensure robust asynchronous validation.

Can I generate nested Zod inputs for complex domain models?

Yes, generating optional nested Zod inputs for complex domain models is supported. The schema generation targets a single domain and supports nested inputs with proper Zod patterns to validate hierarchical data structures.

Why does my Zod domain input schema produce validation errors on optional fields?

Zod domain input schema validation errors on optional fields often occur without explicit optional and nullable field definitions. The generated schema enforces explicit transforms to normalize data, preventing common validation pitfalls.