validators

Validate tRPC procedure inputs and outputs with Zod, Yup, or custom validators.

2|Updated Apr 11, 2026
One-click install
npx skills add https://github.com/PlazaCC/antes-da-tela --skill validators
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: validators
Source: https://github.com/PlazaCC/antes-da-tela/tree/main/.agents/skills/validators
Command: npx skills add https://github.com/PlazaCC/antes-da-tela --skill validators

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Many tRPC procedures return or accept data that can drift from expected shapes, causing runtime type mismatches, unclear errors, and unreliable APIs; this Skill clarifies how to validate inputs and outputs to prevent those failures and surface appropriate errors.

Core Features & Use Cases

  • Input Validation: Use Zod, Yup, Superstruct, ArkType, Valibot, Effect, or custom validator functions to validate procedure inputs.
  • Input Chaining: Merge multiple object schemas across chained .input() calls so base procedures and derived procedures combine shapes correctly.
  • Output Validation: Validate server responses and surface INTERNAL_SERVER_ERROR when the server produces invalid output, protecting clients from inconsistent data.
  • Custom Validators & Patterns: Support custom validator functions and standard schema protocol; covers common pitfalls like non-object input chaining and cursor nullability for infinite queries.
  • Use Case: Harden a publicProcedure that composes middleware and derived inputs while ensuring paginated queries accept nullish cursors and return validated payloads.

Quick Start

Use the validators skill to add Zod input schemas and output validators to your tRPC procedures.

Frequently Asked Questions about validators

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

FAQPage Schema
How do I validate tRPC procedure inputs and outputs to prevent runtime type mismatches?

Validate tRPC procedure inputs and outputs using Zod, Yup, Superstruct, Valibot, Effect, or custom functions to prevent runtime type mismatches. Server-side output validation surfaces an INTERNAL_SERVER_ERROR when responses drift from expected shapes.

Can I merge multiple object schemas when chaining tRPC procedure inputs?

Chaining tRPC procedure inputs merges multiple object schemas across consecutive .input() calls. This allows base procedures and derived procedures to combine their input shapes correctly for comprehensive request validation.

Does tRPC output validation protect clients from inconsistent server data?

tRPC output validation protects clients from inconsistent server data by enforcing server-side response checks. When the server produces invalid output, it surfaces an INTERNAL_SERVER_ERROR instead of passing malformed payloads to the client.

How do I handle infinite-pagination cursor nullability in tRPC validation?

Handle infinite-pagination cursor nullability in tRPC validation by ensuring paginated queries accept nullish cursors. This specific pattern prevents validation failures when fetching initial pages without a cursor parameter.

What is the best way to use custom validator functions with tRPC procedures?

Use custom validator functions with tRPC procedures by applying standard schema protocol support. This approach allows you to implement tailored validation logic beyond standard Zod or Yup schemas for complex input requirements.