zod-contract-testing

Validate Zod schemas at system boundaries for API and WebSocket contracts.

5|1|Updated Feb 23, 2026
One-click install
npx skills add https://github.com/apankov1/quality-engineering --skill zod-contract-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: zod-contract-testing
Source: https://github.com/apankov1/quality-engineering/tree/main/skills/zod-contract-testing
Command: npx skills add https://github.com/apankov1/quality-engineering --skill zod-contract-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Boundary testing ensures that Zod schemas enforce runtime contracts at system boundaries, catching invalid data early and preventing schema drift from affecting downstream logic.

Core Features & Use Cases

  • Validates inputs at boundaries using testValidInput and testInvalidInput, ensuring both acceptance and rejection cases.
  • Supports schema evolution testing and version compatibility checks with testSchemaEvolution, generateVersionCompatibilityMatrix, and assertVersionCompatibility.
  • Provides refinement testing with testRefinement and compound state matrix generation for 2^N optional fields.
  • Demonstrates integration-ready patterns for boundary validation in API handlers, WebSocket messages, and data ingestion.

Quick Start

Run the boundary-testing workflow on a sample Zod schema to verify valid/invalid inputs and evolution rules.

Frequently Asked Questions about zod-contract-testing

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

FAQPage Schema
How do I test Zod schemas for boundary validation in API handlers?

You can test Zod schemas for boundary validation by applying testValidInput and testInvalidInput utilities to ensure your API handlers correctly accept valid data and reject invalid payloads at system boundaries.

What is schema evolution testing and how does it work with Zod?

Schema evolution testing verifies that your Zod schemas remain stable and evolvable across versions. You use testSchemaEvolution and generateVersionCompatibilityMatrix to enforce version compatibility rules for runtime data contracts.

Can I test Zod refinements and compound optional field states?

Yes, you can test Zod refinements using testRefinement and generate compound state matrices for 2^N optional fields with generateCompoundStateMatrix to verify complex boundary validation logic.

Does Zod contract testing work for WebSocket messages and data migrations?

Zod contract testing applies to WebSocket messages and data migrations by validating runtime data contracts at these system boundaries, ensuring stable interfaces and preventing schema drift from affecting downstream logic.

What's the best way to prevent schema drift when validating runtime data?

The best way to prevent schema drift is to enforce boundary-tested Zod schemas at system boundaries, catching invalid data early and ensuring stable, evolvable interfaces across multiple versions using compatibility matrices.

When do I need to generate a version compatibility matrix for my schemas?

You need to generate a version compatibility matrix when evolving your Zod schemas across versions, using generateVersionCompatibilityMatrix to verify that interface changes maintain stable contracts for runtime data ingestion.