Entry point for all tRPC skills. Decision tree routing by task: initTRPC.create(), t.router(), t.procedure, createTRPCClient, adapters, subscriptions, React Query, Next.js, links, middleware, validators, error handling, caching, FormData.
Getting started
Full instructionsInstall the skill, then ask your AI tool for the task in plain words. The full SKILL.md below shows what it covers.
Instructions: SKILL.mdv1.0.0
tRPC -- Skill Router
Decision Tree
What are you trying to do?
Define a tRPC backend (server)
-
Initialize tRPC, define routers, procedures, context, export AppRouter
-> Load skill:server-setup -
Add middleware (.use), auth guards, logging, base procedures
-> Load skill:middlewares -
Add input/output validation with Zod or other libraries
-> Load skill:validators -
Throw typed errors, format errors for clients, global error handling
-> Load skill:error-handling -
Call procedures from server code, write integration tests
-> Load skill:server-side-calls -
Set Cache-Control headers on query responses (CDN, browser caching)
-> Load skill:caching -
Accept FormData, File, Blob, or binary uploads in mutations
-> Load skill:non-json-content-types -
Set up real-time subscriptions (SSE or WebSocket)
-> Load skill:subscriptions
Host the tRPC API (adapters)
-
Node.js built-in HTTP server (simplest, local dev)
-> Load skill:adapter-standalone -
Express middleware
-> Load skill:adapter-express -
Fastify plugin
-> Load skill:adapter-fastify -
AWS Lambda (API Gateway v1/v2, Function URLs)
-> Load skill:adapter-aws-lambda -
Fetch API / Edge (Cloudflare Workers, Deno, Vercel Edge, Astro, Remix)
-> Load skill:adapter-fetch
Consume the tRPC API (client)
-
Create a vanilla TypeScript client, configure links, headers, types
-> Load skill:client-setup -
Configure link chain (batching, streaming, splitting, WebSocket, SSE)
-> Load skill:links -
Use SuperJSON transformer for Date, Map, Set, BigInt
-> Load skill:superjson
Use tRPC with a framework
-
React with TanStack Query (useQuery, useMutation, queryOptions)
-> Load skill:react-query-setup -
Next.js App Router (RSC, server components, HydrateClient)
-> Load skill:nextjs-app-router -
Next.js Pages Router (withTRPC, SSR, SSG helpers)
-> Load skill:nextjs-pages-router
Advanced patterns
-
Generate OpenAPI spec, REST client from tRPC router
-> Load skill:openapi -
Multi-service gateway, custom routing links, SOA
-> Load skill:service-oriented-architecture -
Auth middleware + client headers + subscription auth
-> Load skill:auth
Quick Reference: Minimal Working App
// server/trpc.ts
import { initTRPC } from '@trpc/server';
const t = initTRPC.create();
export const router = t.router;
export const publicProcedure = t.procedure;
// server/appRouter.ts
import { z } from 'zod';
import { publicProcedure, router } from './trpc';
export const appRouter = router({
hello: publicProcedure
.input(z.object({ name: z.string() }))
.query(({ input }) => ({ greeting: `Hello ${input.name}` })),
});
export type AppRouter = typeof appRouter;
// server/index.ts
import { createHTTPServer } from '@trpc/server/adapters/standalone';
import { appRouter } from './appRouter';
const server = createHTTPServer({ router: appRouter });
server.listen(3000);
// client/index.ts
import { createTRPCClient, httpBatchLink } from '@trpc/client';
import type { AppRouter } from '../server/appRouter';
const trpc = createTRPCClient<AppRouter>({
links: [httpBatchLink({ url: 'http://localhost:3000' })],
});
const result = await trpc.hello.query({ name: 'World' });
See Also
server-setup-- full server initialization detailsclient-setup-- full client configurationadapter-standalone-- simplest adapter for getting startedreact-query-setup-- React integrationnextjs-app-router-- Next.js App Router integration
Explore more skills
Browse all- Adapter FastifyMount tRPC as a Fastify plugin with fastifyTRPCPlugin from @trpc/server/adapters/fastify. Configure prefix, trpcOptions…
- Typescript Best PracticesTypeScript best practices. Use when reading or editing any .ts or .tsx file.
- Adapter FetchDeploy tRPC on WinterCG-compliant edge runtimes with fetchRequestHandler() from @trpc/server/adapters/fetch. Supports…
- Service Oriented ArchitectureBreak a tRPC backend into multiple services with custom routing links that split on the first path segment…
- React Query Classic MigrationMigrate from @trpc/react-query (classic) to @trpc/tanstack-react-query. Run npx @trpc/upgrade CLI for automated…
- Nextjs Pages RouterSet up tRPC in Next.js Pages Router with createNextApiHandler, createTRPCNext, withTRPC HOC, SSR via ssr option and…
Security
Reviews (0)
More from tRPC
View source →Frequently asked questions about trpc-router
What does the trpc-router skill do?
Entry point for all tRPC skills. Decision tree routing by task: initTRPC.create(), t.router(), t.procedure, createTRPCClient, adapters, subscriptions, React Query, Next.js, links, middleware, validators, error handling, caching, FormData. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.
How do I install the trpc-router skill?
Run `npx @skills-hub-ai/cli install trpc-router` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/trpc-router/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.
Which AI tools does trpc-router work with?
trpc-router runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.
Is the trpc-router skill free?
Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.
How do I use trpc-router after installing it?
In Claude Code, type `/trpc-router` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.
Can I share the trpc-router skill with my team?
Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.
Badge for your README
Show that this skill is on Skills Hub. The badge links back to this page and shows the live install count.
[](https://skills-hub.ai/skills/trpc-router)<a href="https://skills-hub.ai/skills/trpc-router"><img src="https://skills-hub.ai/api/badges/skill/trpc-router" alt="Install on Skills Hub"></a>More options in the badge docs.