server-setup

Initialize and configure typed tRPC servers and routers.

2|Updated Apr 11, 2026
One-click install
npx skills add https://github.com/PlazaCC/antes-da-tela --skill server-setup
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: server-setup
Source: https://github.com/PlazaCC/antes-da-tela/tree/main/.agents/skills/server-setup
Command: npx skills add https://github.com/PlazaCC/antes-da-tela --skill server-setup

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill documents an opinionated, reliable way to initialize and structure a typed tRPC server to avoid type mismatches, accidental server bundling into client code, and runtime errors when merging routers or configuring context.

Core Features & Use Cases

  • Single shared t instance: Create initTRPC once and reuse t.router and t.procedure to prevent cross-instance type mismatches.
  • Typed context patterns: Implement inner/outer context splits to make server-side testing simple and avoid leaking HTTP objects into tests.
  • Router composition & lazy loading: Merge child routers safely with consistent transformers and support lazy-loaded routers to reduce cold-start cost in serverless deployments.
  • Common mistakes to avoid: Guidance on reserved procedure names, exporting AppRouter as a type-only import, and ensuring transformer consistency when merging routers.

Quick Start

Initialize a minimal tRPC server using a single initTRPC instance, export router and publicProcedure, create typed context with an inner factory, and merge child routers into an AppRouter.

Frequently Asked Questions about server-setup

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

FAQPage Schema
How do I set up a typed tRPC server to avoid type mismatches when merging routers?

To avoid type mismatches when merging routers, initialize a single shared initTRPC instance and reuse its router and procedure methods. This ensures consistent typing across all merged child routers and procedures.

Why does my tRPC context leak HTTP objects into my server-side tests?

Your tRPC context leaks HTTP objects because it lacks an inner and outer context split. By creating an inner context factory, you separate HTTP request data from business logic, making server-side testing simple and isolated.

What is the best way to reduce cold-start cost for tRPC routers in serverless deployments?

The best way to reduce cold-start cost for tRPC routers in serverless deployments is to implement lazy-loaded routers. This pattern defers module loading until needed, optimizing startup performance for Node.js and serverless backends.

Can I export the tRPC AppRouter directly to the client without bundling server code?

You cannot export the tRPC AppRouter directly to the client without bundling server code. You must export AppRouter as a type-only import to ensure the server implementation stays isolated from the client bundle.

Do I need consistent transformers when merging tRPC child routers?

You need consistent transformers when merging tRPC child routers to prevent runtime errors and data serialization issues. Ensuring transformer consistency across all merged routers maintains data integrity across the RPC API.