跳到正文
TakoAPI
返回技能列表

lb-zod-skill

由 leonaaardob 提供

Web & Frontend Development
983下载量由 clawskills.sh 提供
0浏览量
0 个赞登录后即可为这个技能点赞
—暂无评分
你的评分

简介

Complete Zod validation library documentation.

描述

该技能的功能

Zod is a TypeScript-first schema validation library. It lets you define schemas for data structures and parse or validate values at runtime, with automatic TypeScript type inference from those schemas.

Zod eliminates the need to maintain separate TypeScript types and runtime validators by inferring types directly from schemas.

何时使用

  • Validating API request bodies before processing
  • Parsing environment variables with type safety
  • Form validation in React with React Hook Form
  • Validating tRPC router inputs and outputs
  • Runtime type checking of third-party API responses

示例工作流

输入

User asks: how do I validate a user signup form with email and password requirements?

智能体
  1. 1

    Read api.mdx to find string schema methods like .email() and .min()

  2. 2

    Read error-customization.mdx to find how to set custom error messages

  3. 3

    Construct a z.object() schema with z.string().email() and z.string().min(8)

  4. 4

    Show how to use safeParse() to get validation errors without throwing

  5. 5

    Demonstrate extracting typed data from the result on success

输出

A complete schema definition with field-level error messages and a safeParse usage example

安装

clawhub install leonaaardob/lb-zod-skill

运行 CLI 命令,或把这段提示词粘贴到 Claude Code、Cursor、Codex 或你在用的任意编程智能体里。

链接