Agent skill · Backend & API

trpc-router

TRPC router development guide. Use when creating or modifying apps/server/src/routers, adding procedures, or implementing server-side API endpoints.

LobeHub80,937★ · +310/wk · 1 repos on radarProfile →
claude-codeNOASSERTION
Install
npx skills add lobehub/lobehub --skill trpc-router --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 4 KB
Bundled scripts: none
Path: .agents/skills/trpc-router/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 81,252 · +315 this week
Language: TypeScript
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# TRPC Router Guide ## File Location - Routers: `apps/server/src/routers/lambda/<domain>.ts` - Helpers: `apps/server/src/routers/lambda/_helpers/` - Schemas: `apps/server/src/routers/lambda/_schema/` ## Router Structure ### Imports ```typescript import { TRPCError } from '@trpc/server'; import { z } from 'zod'; import { SomeModel } from '@/database/models/some'; import { authedProcedure, router } from '@/libs/trpc/lambda'; import { serverDatabase } from '@/libs/trpc/lambda/middleware'; ``` ### Middleware: Inject Models into ctx **Always use middleware to inject models into `ctx`** instead of creating `new Model(ctx.serverDB, ctx.userId)` inside every procedure. ```typescript const domainProcedure = authedProcedure.use(serverDatabase).use(async (opts) => { const { ctx } = opts; return opts.next({ ctx: { fooModel: new FooModel(ctx.serverDB, ctx.userId), barModel: new BarModel(ctx.serverDB, ctx.userId), }, }); }); ``` Then use `ctx.fooModel` in procedures: ```typescript // Good const model = ctx.fooModel; // Bad - don't create models inside procedures const model = new FooModel(ctx.serverDB, ctx.userId); ``` **Exception**: When a model needs a different `userId` (e.g., watchdog iterat

What's inside
Steps it walks through
  1. File Location
  2. Router Structure
  3. Imports
  4. Middleware: Inject Models into ctx
  5. Procedure Pattern
  6. Aggregated Detail Endpoint
  7. Conventions
More from lobehub
All skills →
About this skill
What does the trpc-router skill do?

TRPC router development guide. Use when creating or modifying apps/server/src/routers, adding procedures, or implementing server-side API endpoints.

How do I install it?

Run `npx skills add lobehub/lobehub --skill trpc-router --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From lobehub/lobehub, a repository with 81,252 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going