trpc-conventions

Standardize tRPC router conventions with Zod validation and TRPCError handling.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/leonardoacosta/Installfest --skill trpc-conventions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: trpc-conventions
Source: https://github.com/leonardoacosta/Installfest/tree/main/automate/.claude/skills/trpc-conventions
Command: npx skills add https://github.com/leonardoacosta/Installfest --skill trpc-conventions

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a set of tRPC router conventions for Otaku Odyssey, including pagination, CRUD-like operations, error handling, and consistent client usage patterns.

Core Features & Use Cases

  • Router Structure: Standardized router structure with input validation via Zod and protectedProcedure usage.
  • Error Handling: Consistent TRPCError usage and codes such as NOT_FOUND, UNAUTHORIZED, FORBIDDEN, BAD_REQUEST.
  • Client Usage Pattern: Examples for calling routers from React components using the api hooks.

Quick Start

Create a new tRPC router following the conventions shown, including input validation and protected procedures.

Frequently Asked Questions about trpc-conventions

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

FAQPage Schema
How do I standardize tRPC router patterns for API endpoints?

tRPC router conventions establish a standardized structure for building API endpoints with consistent input validation via Zod, protected procedures, error handling using TRPCError codes, and pagination. This ensures maintainable CRUD-like operations across your backend.

What's the best way to implement protected procedures and error handling in tRPC?

Use protectedProcedure for routes requiring authentication and handle errors with TRPCError using specific codes like NOT_FOUND, UNAUTHORIZED, FORBIDDEN, and BAD_REQUEST. This pattern ensures consistent error responses and enforces access control across all endpoints.

How do I build tRPC routers with Zod validation and drizzle-orm queries?

Define tRPC procedures with Zod schemas for input validation, then execute drizzle-orm database queries within the procedure logic. Chain validation and database operations to ensure type-safe, validated data flow from client to database.

Can I use tRPC router conventions with React components and pagination?

Yes. Call tRPC routers from React components using the api hooks, implementing pagination through limit and offset parameters. This provides type-safe, end-to-end integration with consistent client usage patterns.

What error codes should I use in tRPC for API responses?

Apply TRPCError codes including NOT_FOUND for missing resources, UNAUTHORIZED for missing credentials, FORBIDDEN for insufficient permissions, and BAD_REQUEST for invalid input. These standardized codes enable predictable client-side error handling.

Why use router conventions for building multiple API endpoints?

Router conventions reduce maintenance overhead and inconsistency when creating features-related routes for list, getById, create, update, and delete operations. Standardization ensures all endpoints follow the same validation, error handling, and export patterns.