api-validation

Enforce API contracts with Zod and OpenAPI schemas for REST and RPC endpoints.

Updated Dec 13, 2025
One-click install
npx skills add https://github.com/imehr/vet --skill api-validation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-validation
Source: https://github.com/imehr/vet/tree/main/.claude/skills/api-validation
Command: npx skills add https://github.com/imehr/vet --skill api-validation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill ensures API contracts stay in sync by defining inputs and outputs with type-safe schemas, reducing runtime errors and mismatches between client and server.

Core Features & Use Cases

  • Contract-first validation: Define input/output DTOs with Zod and OpenAPI to prevent drift.
  • Runtime safety: Validates and parses data at API boundaries, transforming it into trusted domain types.
  • Documentation & integration: Generates OpenAPI docs and TypeScript types; integrates with Express, Next.js, or tRPC.

Use Case: When designing an API, apply contract-driven design to guarantee end-to-end type safety and robust error handling.

Quick Start

  • Ensure Zod and OpenAPI tooling are available in your project.
  • Create schemas like CreateUserSchema and wire them to endpoints with validators.
  • Validate outgoing responses against a response schema to enforce consistent API shapes.

Frequently Asked Questions about api-validation

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

FAQPage Schema
How do I enforce API contracts to prevent client and server type drift?

To enforce API contracts and prevent type drift, define input and output DTOs using Zod and OpenAPI schemas. This establishes a single source of truth, ensuring runtime validation and parsing at API boundaries before transforming data into trusted domain types.

Can I integrate Zod and OpenAPI validation with tRPC for end-to-end type safety?

Yes, you can integrate Zod and OpenAPI validation with tRPC for end-to-end type safety. This skill applies contract-driven design to both REST and RPC endpoints, guaranteeing consistent data shapes and robust error handling across your stack.

What's the best way to validate outgoing API responses against a schema?

The best way to validate outgoing API responses is to wire your endpoints with response schemas. Validating outgoing data against a defined OpenAPI or Zod schema enforces consistent API shapes and prevents unexpected client-side runtime errors.

Does contract-driven API design require Zod and OpenAPI tooling installed?

Yes, contract-driven API design requires Zod and OpenAPI tooling to be available in your project. These dependencies are necessary to define type-safe schemas, generate OpenAPI docs and TypeScript types, and apply runtime validation.

Why do I need runtime validation at API boundaries if I already use TypeScript?

You need runtime validation at API boundaries because TypeScript only checks types at compile time. Applying Zod schemas at the boundary validates incoming data at runtime, transforming untrusted external payloads into verified domain types safely.

Can I use this schema validation approach with Express and Next.js?

Yes, you can use this schema validation approach with Express and Next.js. It generates OpenAPI documentation and TypeScript types while wiring validators to endpoints, ensuring robust error handling across different web frameworks.