trpc

Implement tRPC routers and procedures in Next.js App Router projects.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/perimetre/ai-toolkit --skill trpc-perimetre
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: trpc
Source: https://github.com/perimetre/ai-toolkit/tree/main/plugins/perimetre-apps/skills/trpc
Command: npx skills add https://github.com/perimetre/ai-toolkit --skill trpc-perimetre

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

End-to-end type-safe APIs can be hard to maintain without schemas or code generation; this skill provides a structured pattern to implement tRPC in Next.js App Router with shared types and robust error handling.

Core Features & Use Cases

  • End-to-end type safety across client and server without runtime schema generation.
  • Router, procedures, and middleware patterns with context propagation and error handling.
  • Service-layer integration and input validation using a robust error-as-value approach for reliable workflows.

Quick Start

Copy the tRPC boilerplate structure from the referenced Next.js App Router example and adapt it to your project.

Frequently Asked Questions about trpc

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

FAQPage Schema
How do I build end-to-end type-safe APIs in Next.js without code generation?

You can build end-to-end type-safe APIs in Next.js by using tRPC routers and procedures, sharing types directly between client and server without runtime schema generation.

How do I set up tRPC routers and middleware with context propagation in Next.js App Router?

Setting up tRPC routers and middleware with context propagation in Next.js App Router involves structuring procedures to enforce input validation and pass shared context consistently across requests.

What is the best way to handle API errors in TypeScript without exceptions?

The best way to handle API errors in TypeScript is using an error-as-value result pattern, which ensures reliable workflows by treating errors as returned values rather than throwing exceptions.

Does tRPC work with Next.js App Router to maintain type safety across client and server?

Yes, tRPC works with Next.js App Router to maintain type safety across client and server, providing a structured pattern for procedures, middleware, and service-layer integration.

How do I enforce input validation in a tRPC service layer?

To enforce input validation in a tRPC service layer, you define validation schemas within your procedures to ensure data integrity before processing requests through the service layer.