trpc/SKILL.md
tRPC — end-to-end typesafe APIs for TypeScript without schemas or code generation. Use when building with tRPC or asking about its router setup, procedures, middleware, context, subscriptions, or integration with React, Next.js, or other frameworks. Fetch live documentation for up-to-date details.
npx skillsauth add mikkelkrogsholm/dev-skills trpcInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
CRITICAL: Your training data for tRPC is unreliable. APIs change between versions and memorized patterns may be wrong or deprecated. Before writing any code, you MUST use
WebFetchto read the live docs:
WebFetch("https://trpc.io/llms.txt")Do not proceed without fetching this URL first. Never assume an API exists — verify against current docs.
tRPC enables end-to-end typesafe APIs for TypeScript without requiring schemas or code generation. Type safety flows automatically from server procedure definitions to React hooks and client calls.
tRPC ships with built-in support for patterns that commonly require external libraries:
wsLink, httpSubscriptionLink)httpBatchLink — the recommended default link used in all official quickstart setups (must be explicitly configured in the client's links option)superjson transformer option — no manual serialization layercreateCallerFactory()t.middleware() — result passed through typed ctx augmentationAlways use appRouter type export, never the router value, for client-side type inference. Importing the router value on the client creates a bundle dependency on server code. Export only the type: export type AppRouter = typeof appRouter. Agents often import the full router by mistake, which can bundle server-only code or cause circular imports.
Procedures are not callable unless registered on a router. A procedure built with .query() or .mutation() is a definition, not a live endpoint. It must be added to a router object passed to createHTTPServer or the Next.js adapter. Agents sometimes call createCallerFactory on a bare procedure instead of a router.
Context is created per-request — never mutate shared state inside createContext. Each request receives a fresh context object. Storing request-scoped data (user session, request ID) in a module-level variable instead of returning it from createContext causes data leakage between concurrent requests.
Nest sub-routers under named keys, not flat. Use t.router({ posts: postRouter, users: userRouter }) to create typed namespaces. Use t.mergeRouters(a, b) only when you intentionally want a flat merge with no nesting — otherwise type inference for namespaced routes breaks.
Set abortOnUnmount: true on the tRPC React provider to cancel in-flight requests on component unmount. By default tRPC does not abort queries when a component unmounts, which causes state updates on unmounted components and potential race conditions in fast navigation scenarios.
development
Zod — TypeScript-first schema validation with static type inference. Use when building with Zod or asking about schema definitions, type inference, parsing, transformations, refinements, coercion, error handling, or integration with forms, APIs, or tRPC. Fetch live documentation for up-to-date details.
tools
Vite — next-generation frontend build tool with instant dev server and optimized production builds. Use when building with Vite or asking about its APIs, configuration, plugins, SSR, environment variables, or integration with frameworks. Fetch live documentation for up-to-date details.
tools
Upstash — serverless Redis, QStash, and Vector database with per-request pricing optimized for edge and serverless environments. Use when building with Upstash or asking about its Redis client, QStash message queuing, rate limiting, workflows, or vector search. Fetch live documentation for up-to-date details.
tools
Turso — edge-hosted SQLite database built on libSQL with embedded replicas, multi-tenancy, and low-latency global distribution. Use when building with Turso or asking about its libSQL client, embedded replicas, database-per-tenant patterns, auth tokens, sync, or integration with Drizzle or other ORMs. Fetch live documentation for up-to-date details.