trpc

Standardize tRPC v11 router layout, Zod inputs, and auth middleware.

Updated May 23, 2026
One-click install
npx skills add https://github.com/devturco/thiago-dev-template --skill trpc-devturco
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: trpc
Source: https://github.com/devturco/thiago-dev-template/tree/main/.claude/skills/trpc
Command: npx skills add https://github.com/devturco/thiago-dev-template --skill trpc-devturco

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents brittle, schema-mismatched, and hard-to-maintain API code by enforcing end-to-end type safety across tRPC procedures, inputs, and React data access patterns.

Core Features & Use Cases

  • Zod-powered input validation on every procedure to ensure runtime safety that matches TypeScript types.
  • Feature-based router organization so the API grows by domain (e.g., userRouter, postRouter) instead of becoming a monolith.
  • Correct client/server integration using tRPC v11 patterns with SuperJSON transformation, batching, and React Query-powered hooks.
  • Use of authorization procedure levels (public/protected/admin) with middleware for consistent auth enforcement.

Quick Start

Ask: "Use the trpc skill to outline how to structure my server routers with Zod inputs, add a protected procedure with middleware auth, and wire the typed client hooks in my Next.js app."

Frequently Asked Questions about trpc

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

FAQPage Schema
How do I structure tRPC routers with Zod inputs in Next.js?

Structure tRPC routers by organizing procedures into feature-based domain routers like userRouter and postRouter, applying Zod schemas to every input for runtime validation that matches your TypeScript types.

How does SuperJSON transformation work with tRPC v11 client hooks?

SuperJSON transformation enables tRPC v11 client hooks to correctly serialize and deserialize complex types like Date objects across the network, ensuring end-to-end type safety when using batching links and React Query-powered hooks.

What is the best way to add protected procedure auth middleware in tRPC?

Add protected procedure auth middleware in tRPC by defining authorization levels such as public, protected, and admin, applying middleware to enforce consistent authentication before procedure execution and throwing TRPCError on failure.

Can I use tRPC with React Query for batching API requests?

Yes, tRPC v11 integrates natively with React Query, using batching links to combine multiple procedure calls into a single network request while maintaining strict end-to-end type safety across your Next.js application.

Why do I need Zod validation on every tRPC procedure?

You need Zod validation on every tRPC procedure to ensure runtime input safety that strictly matches your TypeScript types, preventing schema mismatches and brittle API code from reaching your backend logic.

Does tRPC v11 support feature-based router organization for scalable APIs?

Yes, tRPC v11 supports feature-based router organization, allowing your API to scale cleanly by domain instead of becoming a monolith, combining multiple routers into a single root appRouter with full type inference.