Skip to main content
rulesSource-backedReview first Safety · Privacy

tRPC Expert - CLAUDE.md Rules for Claude Code

Transform Claude into a tRPC specialist with deep knowledge of end-to-end typed routers, procedures, middleware, and React client integration patterns.

by jaso0n0818·added 2026-06-19·
HarnessClaude Code
Review first review before installing

Open the source and read safety notes before installing.

Privacy notes

  • Procedures may access session tokens and database credentials; never log secrets in middleware or error formatters.

Schema details

Install type
copy
Troubleshooting
No
Full copyable content
You are an expert tRPC developer focused on end-to-end type safety and clear router design.

## Router composition

- Split routers by domain (`userRouter`, `postRouter`) and merge in `appRouter`
- Use `publicProcedure`, `protectedProcedure`, or custom middleware for auth boundaries
- Validate all inputs with Zod schemas at the procedure boundary

## Procedures and errors

```typescript
export const postRouter = router({
  byId: publicProcedure
    .input(z.object({ id: z.string().uuid() }))
    .query(({ ctx, input }) => ctx.db.post.findUnique({ where: { id: input.id } })),
});
```

- Throw `TRPCError` with appropriate codes (`NOT_FOUND`, `FORBIDDEN`, `BAD_REQUEST`)
- Map domain errors in middleware; keep handlers focused on business logic

## Middleware and context

- Build context once per request; inject db, session, and tracing identifiers
- Chain middleware for logging, rate limits, and role checks
- Avoid leaking internal error details in production responses

## Client integration

- Use `@trpc/react-query` hooks with shared QueryClient configuration
- Prefetch critical queries in loaders or SSR helpers when applicable
- Type inference from `AppRouter` should flow to client without manual duplication

About this resource

Use these rules when building or reviewing tRPC routers and typed clients.

Source citations

Add this badge to your README

Show that tRPC Expert - CLAUDE.md Rules for Claude Code is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.

Listed on HeyClaude
[![Listed on HeyClaude](https://heyclau.de/badge/rules/trpc-expert.svg)](https://heyclau.de/entry/rules/trpc-expert)

How it compares

tRPC Expert - CLAUDE.md Rules for Claude Code side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.

FieldtRPC Expert - CLAUDE.md Rules for Claude Code

Transform Claude into a tRPC specialist with deep knowledge of end-to-end typed routers, procedures, middleware, and React client integration patterns.

Open dossier
API First Dev Expert - CLAUDE.md Rules for Claude Code

A CLAUDE.md rule set for contract-first backend work: define OpenAPI, tRPC, and GraphQL schemas before code, generate typed clients, and enforce request and response validation.

Open dossier
Vue 3 Composition API Expert - CLAUDE.md Rules for Claude Code

Transform Claude into a Vue 3 specialist with deep knowledge of the Composition API, script setup syntax, Pinia state management, and Vue Router best practices.

Open dossier
Angular Expert - CLAUDE.md Rules for Claude Code

Transform Claude into an Angular specialist with deep knowledge of standalone components, Angular Signals, dependency injection, RxJS patterns, and the Angular Style Guide.

Open dossier
Trust
Install riskReview firstReview firstReview firstReview first
Notes Safety · Privacy Safety Privacy Safety · Privacy · Safety · Privacy ·
Categoryrulesrulesrulesrules
Sourcesource-backedsource-backedsource-backedsource-backed
Authorjaso0n0818JSONboredjaso0n0818jaso0n0818
Added2026-06-192025-10-252026-06-132026-06-13
Platforms
Claude Code
Claude Code
Claude Code
Claude Code
Source repo
Safety notes— missingThis rule is prompt guidance, not executable code, but it directs Claude to design REST, tRPC, and GraphQL endpoints that create and modify records (for example POST and PATCH handlers); review and authorize generated write operations before deploying them. The guidance exposes public, versioned API surfaces and recommends SDK/client generation; enforce request validation and the documented middleware order so authentication runs before authorization on every generated endpoint.— missing— missing
Privacy notesProcedures may access session tokens and database credentials; never log secrets in middleware or error formatters.The recommended patterns authenticate with JWT, OAuth 2.0/OIDC, and bearer tokens; keep API keys, client secrets, and tokens in environment variables or a secrets manager and never commit them or paste them into OpenAPI examples. Generated contracts can return user records such as email, role, and identifiers; apply authorization and field-level filtering so responses do not over-expose personal data.— missing— missing
Prerequisites— none listed— none listed— none listed— none listed
Install
Config
Citations
ClaimUnclaimedUnclaimedUnclaimedUnclaimed

Signals

Loading live community signals…

More like this, weekly

A short, calm digest of reviewed Claude resources. Unsubscribe any time.