api-schema-zod

📁 rimthan-lab/rimthan-plugins 📅 1 day ago
2
总安装量
2
周安装量
#70706
全站排名
安装命令
npx skills add https://github.com/rimthan-lab/rimthan-plugins --skill api-schema-zod

Agent 安装分布

opencode 2
claude-code 2
cursor 2
mcpjam 1
openhands 1
zencoder 1

Skill 文档

Zod Schemas

Purpose

Generate Zod validation schemas that can be used both on the backend for validation and shared with the frontend for type-safe API contracts.

When to Use

  • Creating reusable validation schemas
  • Sharing schemas between backend and frontend
  • Type-safe API contracts
  • Runtime validation with TypeScript inference

What It Generates

Directory Structure

packages/shared-schemas/src/schemas/{feature}/
├── {entity}.schema.ts
├── index.ts

Patterns Enforced

Schema Reusability

  • Common schemas (email, password, UUID) imported from shared
  • Schemas composable via .pick(), .omit(), .extend()
  • Transformations for data normalization

Type Inference

  • z.infer<typeof schema> for TypeScript types
  • Types can be exported to frontend

Error Messages

  • Custom validation messages
  • User-friendly error descriptions

Usage Example

/skill schema-zod --name=User --fields='email:email,password:password,name:string,isActive:boolean'

Related Files