Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
oakoss avatar

Trpc

  • 67 installs
  • 14 repo stars
  • Updated March 2, 2026
  • oakoss/agent-skills

Helps with ai & agent building tasks during AI-assisted development.

About

trpc is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.

  • trpc
  • AI & Agent Building
  • AI-coding skill

Trpc by the numbers

  • 67 all-time installs (skills.sh)
  • +1 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #5,935 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/oakoss/agent-skills --skill trpc

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs67
repo stars14
Last updatedMarch 2, 2026
Repositoryoakoss/agent-skills

What it does

Helps with ai & agent building tasks during AI-assisted development.

Files

SKILL.mdMarkdownGitHub ↗

tRPC

Overview

tRPC enables end-to-end type-safe APIs by sharing TypeScript types between server and client without code generation or schemas. The server defines procedures (queries, mutations, subscriptions) in a router, and the client infers all types from the exported AppRouter type.

When to use: TypeScript full-stack apps needing type-safe API layers, monorepos sharing types, real-time subscriptions, rapid API iteration without OpenAPI/GraphQL overhead.

When NOT to use: Public APIs consumed by non-TypeScript clients (use REST/GraphQL), polyglot backends, projects requiring OpenAPI spec generation as primary output.

Quick Reference

PatternAPIKey Points
InitializeinitTRPC.context<Ctx>().create()Single entry point, configure once
Routert.router({ ... })Nest routers with t.mergeRouters()
Queryt.procedure.input(schema).query(fn)Read operations, cached by clients
Mutationt.procedure.input(schema).mutation(fn)Write operations
Subscriptiont.procedure.subscription(fn)Real-time via WebSocket or SSE
Middlewaret.middleware(fn)Chain with .use(), extend context via next({ ctx })
Standalone middlewareexperimental_standaloneMiddleware<{}>()Reusable with explicit type constraints
ContextcreateContext({ req, res })Per-request, passed to all procedures
Server callert.createCallerFactory(router)Type-safe server-side procedure calls
Errorthrow new TRPCError({ code, message })Mapped to HTTP status codes
Error formatterinitTRPC.create({ errorFormatter })Customize error shape, expose Zod errors
Input validation.input(zodSchema)Multiple .input() calls merge (intersection)
Output validation.output(zodSchema)Strip extra fields from responses
React hookstrpc.useQuery() / trpc.useMutation()Built on @tanstack/react-query
React utilstrpc.useUtils()Invalidate, prefetch, setData on cache
Suspense querytrpc.useSuspenseQuery()Suspense-compatible data fetching
React subscriptiontrpc.useSubscription(input, opts)onData callback for real-time events
Vanilla clientcreateTRPCClient<AppRouter>({ links })No React dependency
Batch linkhttpBatchLink({ url })Batches requests in single HTTP call
Stream linkhttpBatchStreamLink({ url })Streams responses as they resolve
WS linkwsLink({ client: wsClient })WebSocket transport for subscriptions
Split linksplitLink({ condition, true, false })Route operations to different transports
Logger linkloggerLink()Debug request/response in development
Data transformerinitTRPC.create({ transformer })Serialize Dates, Maps, Sets (superjson)
Fetch adapterfetchRequestHandler({ endpoint, req })Cloudflare Workers, Deno, Bun, Next.js
Procedure chainingpublicProcedure.use(auth).use(rateLimit)Build reusable procedure bases

Common Mistakes

MistakeCorrect Pattern
Exporting the full t objectExport only t.router, t.procedure, t.middleware, t.createCallerFactory
Creating context inside procedureCreate context in adapter setup, flows through automatically
Using any for context typeDefine context type with initTRPC.context<MyContext>().create()
Catching errors in proceduresLet errors propagate; use onError in adapter or error formatter
Importing server code on clientImport only type AppRouter, never runtime server code
Using createCaller in production request handlersUse createCallerFactory for type-safe reusable callers
Defining input without validationAlways validate with Zod, Valibot, or ArkType schemas
Nesting routers incorrectlyUse dot notation in keys or t.mergeRouters(), not deep nesting
Different transformers on client/serverBoth sides must use the same transformer (e.g., superjson)
Creating QueryClient inside component renderCreate once outside component or use useState initializer
Manual TypeScript generics on hooksType the router procedures; let inference propagate to client
Not passing signal to fetch in queryFntRPC React handles abort signals automatically

Installation

pnpm add @trpc/server @trpc/client @trpc/react-query @tanstack/react-query zod

For subscriptions, add ws (server) and configure wsLink (client). For SSE-based subscriptions, use httpBatchStreamLink instead.

Delegation

  • Procedure discovery: Use Explore agent
  • Router architecture review: Use Task agent
  • Code review: Delegate to code-reviewer agent
If the tanstack-query skill is available, delegate query/mutation caching, invalidation, and optimistic update patterns to it.
If the zod-validation skill is available, delegate input schema design and validation patterns to it.
If the drizzle-orm skill is available, delegate database query patterns within procedures to it.
If the vitest-testing skill is available, delegate test runner configuration and assertion patterns to it.
If the hono skill is available, delegate Hono framework routing and middleware patterns to it.

References

  • Router and procedure definitions
  • Middleware and context patterns
  • Error handling and formatting
  • React client integration with @trpc/react-query
  • Server-side callers and vanilla client
  • Adapter setup for standalone, Express, Fastify, and Hono
  • Subscriptions and real-time patterns
  • Testing tRPC procedures

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.