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.