orpc-zod-smart-coercion

Coerce inputs to expected Zod v4 types without modifying schemas.

8|Updated Mar 3, 2026
One-click install
npx skills add https://github.com/ali-master/skills --skill orpc-zod-smart-coercion
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: orpc-zod-smart-coercion
Source: https://github.com/ali-master/skills/tree/main/skills/orpc-zod-smart-coercion
Command: npx skills add https://github.com/ali-master/skills --skill orpc-zod-smart-coercion

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @orpc/zod, and includes scripts (resource) components.

What problem does it solve?

This Skill provides a refined alternative to z.coerce, ensuring inputs are automatically coerced to the expected type without altering the input schema.

Core Features & Use Cases

  • Automatic Coercion: Converts inputs to the expected type automatically.
  • No Schema Modification: Preserves the integrity of the input schema.
  • Use Case: When integrating with Zod and needing to ensure input types are correct without changing the schema definition.

Quick Start

Use the oRPC Zod Smart Coercion Skill to automatically coerce input data to the correct type in your application.

Frequently Asked Questions about orpc-zod-smart-coercion

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

FAQPage Schema
How do I automatically coerce inputs to the expected type in Zod without modifying the schema?

Use a smart coercion approach to automatically convert inputs to the expected type in Zod without modifying the schema. It preserves schema integrity while ensuring type safety and input validation.

Does Zod smart coercion work with Zod v4 discrimination unions?

Yes, smart coercion supports Zod v4 discrimination unions. It automatically coerces inputs to the expected type while maintaining the discriminated union logic and schema integrity.

What is the difference between z.coerce and smart coercion for input validation?

Smart coercion automatically coerces inputs to the expected type without altering the input schema, whereas standard z.coerce may modify the schema definition. This approach ensures type safety without changing the original schema.

How do I set up automatic input coercion with @orpc/zod?

Set up automatic input coercion with @orpc/zod by applying the coercion script to your Zod schemas. This automatically converts input data to the correct type without changing the schema definition.

When should I use automatic type coercion for input validation?

Use automatic type coercion when integrating with Zod and needing to ensure input types are correct without changing the schema definition. It is ideal for applications requiring type safety and input validation.

Are there limitations to coercing inputs without modifying the Zod schema?

Limitations include ensuring compatibility with Zod v4 discrimination unions and avoiding schema modifications. The coercion script preserves schema integrity but requires careful integration with @orpc/zod for type safety.