跳到正文
TakoAPI
返回技能列表

data-validation

由 gitgoodordietrying 提供

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

简介

Validate data with schemas across languages and formats.

描述

该技能的功能

Schema-based data validation across languages and formats. Covers JSON Schema, Zod for TypeScript, and Pydantic for Python. Handles API boundary validation, file integrity checks, and data migration verification.

Zod and Pydantic both generate JSON Schema from their definitions, so one schema serves validation, type inference, and API documentation simultaneously.

何时使用

  • Validating API request bodies before processing user input
  • Checking CSV column consistency before importing to a database
  • Verifying a data migration preserved all records and field values
  • Defining shared data contracts between microservices
  • Generating TypeScript types or OpenAPI specs from Zod/Pydantic schemas

示例工作流

输入

User asks: validate incoming POST /api/users request bodies in an Express app

智能体
  1. 1

    Define a Zod schema for the expected user shape with email, name, and password constraints

  2. 2

    Add a route handler that calls safeParse on req.body

  3. 3

    Return a 400 with structured error issues if validation fails

  4. 4

    Destructure the validated, typed data from result.data for downstream logic

输出

Express route that rejects malformed requests with field-level error messages and passes typed data to business logic

安装

clawhub install gitgoodordietrying/data-validation

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

链接