trpc

trpc is a skill for Claude Code, Codex from Plazmodium/odin-workflow. It costs 35 tokens per session (2,950 once invoked), scanned A, original, MIT.

Guidance for building tRPC APIs, TypeScript server procedures whose input and output types can be shared with clients, especially in full-stack TypeScript monorepos.

In plain words
What is it for?
Defining routers and procedures, validating inputs with Zod, inferring types, configuring context and error formatting, and connecting clients to React Query.
Why use it?
It helps keep server and client types aligned while handling validation, errors, middleware, and data-fetching integration.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { router, publicProcedure, protectedProcedure } from '../trpc';.

Good fit Defining routers and procedures, validating inputs with Zod, inferring types, configuring context and error formatting, and connecting clients to React Query.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/Plazmodium/odin-workflow
agentmods
npx agentmods add skills/plazmodium/odin-workflow/trpc

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for trpc

README.md
[![agentmods](https://agentmods.dev/badge/skills/plazmodium/odin-workflow/trpc/github.svg)](https://agentmods.dev/skills/plazmodium/odin-workflow/trpc)
Your own site
<a href="https://agentmods.dev/skills/plazmodium/odin-workflow/trpc"><img src="https://agentmods.dev/badge/skills/plazmodium/odin-workflow/trpc/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for trpc

Your own site · 80×15
<a href="https://agentmods.dev/skills/plazmodium/odin-workflow/trpc"><img src="https://agentmods.dev/badge/skills/plazmodium/odin-workflow/trpc.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,950 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00035 $0.02950
Opus 5.5 $0.00014 $0.01180
Sonnet 5.5 $0.00007 $0.00590
Haiku 4.5 $0.00003 $0.00295

Measured 1mo ago against content hash 0dd20a13b864, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

trpc scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/skills/api/trpc/SKILL.md · 504 lines

How it starts

The opening of the file, as written. The whole thing — 504 lines — stays where its author put it; the contents beside it link to each section on GitHub.

tRPC End-to-End Typesafe APIs

Instructions

  1. Assess the project: tRPC is ideal for full-stack TypeScript monorepos.
  2. Follow tRPC conventions:
    • Define routers and procedures
    • Use Zod for input validation
    • Leverage TypeScript inference
    • Integrate with React Query
  3. Provide complete examples: Include server routers and client usage.
  4. Guide on best practices: Error handling, middleware, subscriptions.

Server Setup

Initialize tRPC

// server/trpc.ts
import { initTRPC, TRPCError } from '@trpc/server';
import { type Context } from './context';
import superjson from 'superjson';

const t = initTRPC.context<Context>().create({
  transformer: superjson,
  errorFormatter({ shape, error }) {
    return {
      ...shape,
      data: {
        ...shape.data,
        zodError: error.cause instanceof ZodError
          ? error.cause.flatten()
          : null,
      },
    };
  },
});

export const router = t.router;
export const publicProcedure = t.procedure;
export const middleware = t.middleware;

Context

// server/context.ts
import { type inferAsyncReturnType } from '@trpc/server';
import { type CreateNextContextOptions } from '@trpc/server/adapters/next';
import { getSession } from 'next-auth/react';
import { prisma } from './db';

export const createContext = async (opts: CreateNextContextOptions) => {
  const session = await getSession({ req: opts.req });

  return {
    session,
    user: session?.user,
    prisma,
  };
};

export type Context = inferAsyncReturnType<typeof createContext>;

Middleware

// server/trpc.ts
const isAuthed = middleware(async ({ ctx, next }) => {
  if (!ctx.session?.user) {
    throw new TRPCError({ code: 'UNAUTHORIZED' });
  }
  return next({
    ctx: {
      ...ctx,
      user: ctx.session.user,
    },
  });
});

const isAdmin = middleware(async ({ ctx, next }) => {
  if (ctx.user?.role !== 'ADMIN') {
    throw new TRPCError({ code: 'FORBIDDEN' });
  }
  return next({ ctx });
});

export const protectedProcedure = t.procedure.use(isAuthed);
export const adminProcedure = t.procedure.use(isAuthed).use(isAdmin);

Read the full file on GitHub · 504 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 504 lines · 35 tokens per session scan A 0dd20a13b864

Subscribe to this mod's changes

trpc is a skill published in the GitHub repository Plazmodium/odin-workflow (0 stars, last pushed 4mo ago), licensed MIT. It adds 35 tokens to every session and 2,950 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-01.

Related

Other skills, from other repositories

api-errors

McpError constructor, JsonRpcErrorCode reference, and error handling patterns for @cyanheads/mcp-ts-core. Use when looking up error codes, understanding where errors should be thrown vs. caught, or using ErrorHandler.tryCatch in services.

cyanheads/pubmed-mcp-server · 54 tokens

client-setup

Create a vanilla tRPC client with createTRPCClient (), configure link chain with httpBatchLink/httpLink, dynamic headers for auth, transformer on links (not client constructor). Infer types with inferRouterInputs and inferRouterOutputs. AbortController signal support. TRPCClientError typing.

trpc/trpc · 63 tokens

adapter-express

Mount tRPC as Express middleware with createExpressMiddleware() from @trpc/server/adapters/express. Access Express req/res in createContext via CreateExpressContextOptions. Mount at a path prefix like app.use('/trpc', ...). Avoid global express.json() conflicting with tRPC body parsing for FormData.

trpc/trpc · 67 tokens

trpc-router

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.

trpc/trpc · 59 tokens

pinme-email

Use this skill when a PinMe project (Worker TypeScript) needs to integrate email sending (sendemail). Guides AI to generate correct Worker TS code.

glitternetwork/pinme · 35 tokens

node-modern

Use this skill when writing, reviewing, or refactoring Node.js code — modules, async flow, cancellation, file and process I/O, HTTP — on a current Node.js release. Triggers: user mentions "Node", "Node.js", "ESM", "CommonJS", "require", "import", "fetch", "AbortSignal", "AbortController", "stream", "childprocess"…

WrongStack/WrongStack · 93 tokens