orpc

Build, serve, and call end-to-end typesafe APIs with oRPC v2.

1|Updated Aug 11, 2026
One-click install
npx skills add https://github.com/Chia1104/agent-air --skill orpc-chia1104
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: orpc
Source: https://github.com/Chia1104/agent-air/tree/main/skills/shared/orpc
Command: npx skills add https://github.com/Chia1104/agent-air --skill orpc-chia1104

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Pretrained knowledge of oRPC describes v1 and is frequently wrong for v2, where routing, RPCLink options, and middleware behavior changed. This Skill provides accurate, retrieval-first guidance for building typesafe APIs with oRPC v2 so even trivial one-procedure changes are implemented against the correct API surface. ## Core Features & Use Cases - Procedure and Router Construction: Define procedures with the os builder (.input/.output/.handler) using any Standard Schema validator, assemble routers, and apply middleware with typed context. - Serving and Calling: Serve routers via RPCHandler on fetch, Node, Lambda, Fastify, WebSocket, and other adapters, then call them from server-side clients (call, createRouterClient) or client-side clients (createORPCClient with RPCLink). - Typed Errors and Integrations: Define typesafe errors with ORPCError and .errors, handle them client-side with safe and isDefinedError, and integrate TanStack Query, SSE streaming, and OpenAPI exposure. - Use Case: A project depends on @orpc/server@beta and needs a new authenticated endpoint. Use this Skill to define the procedure with Zod input validation, attach auth middleware with context dedupe, serve it under /rpc, and consume it from a typesafe client. ## Quick Start Use the orpc skill to add a typesafe procedure with input validation and auth middleware to my oRPC v2 router and wire up the client call.

Frequently Asked Questions about orpc

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

FAQPage Schema
How do I define a typesafe API procedure with oRPC?▼

Use the os builder from @orpc/server: chain .input with a Zod, Valibot, or ArkType schema, then implement logic in .handler. Only .handler is required; .output, .errors, and .use middleware are optional steps in the chain.

How do I call oRPC procedures from a client application?▼

Create a client with createORPCClient from @orpc/client and an RPCLink configured with the server origin and url path matching the server prefix. Import the router as a type only so no server code reaches the client bundle.

Does oRPC v2 differ from v1, and how do I migrate?▼

Yes, v2 changed routing to .meta(openapi(...)), split RPCLink url into origin plus path, and removed automatic middleware dedupe. Check installed versions with npm ls @orpc/server and use the orpc-migrate skill to upgrade from v1 or tRPC.

Can oRPC serve the same router as a REST API with OpenAPI?▼

Yes, the @orpc/openapi package provides OpenAPIHandler and OpenAPI 3.2 spec generation for the same router. For REST/OpenAPI-focused work, use the dedicated orpc-openapi skill.

Why does my oRPC middleware run twice in one call?▼

Applying .use at both router and procedure level, or having one procedure call another, can execute the same middleware twice. Cache expensive results in context with a loaded flag so subsequent runs reuse the computed value.

How do I handle typed errors in oRPC clients?▼

Define errors with .errors on the procedure and throw ORPCError or errors.CODE() in handlers. On the client, use safe or createSafeClient with isDefinedError to get typed error codes and data instead of plain try/catch.