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.
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 duplicationAbout this resource
Use these rules when building or reviewing tRPC routers and typed clients.
Source citations
Add this badge to your README
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.
| Field | 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. 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 risk | Review first | Review first | Review first | Review first |
| Notes | Safety · Privacy ✓ | Safety ✓ Privacy ✓ | Safety · Privacy · | Safety · Privacy · |
| Category | rules | rules | rules | rules |
| Source | source-backed | source-backed | source-backed | source-backed |
| Author | jaso0n0818 | JSONbored | jaso0n0818 | jaso0n0818 |
| Added | 2026-06-19 | 2025-10-25 | 2026-06-13 | 2026-06-13 |
| Platforms | Claude Code | Claude Code | Claude Code | Claude Code |
| Source repo | — | — | — | — |
| Safety notes | — missing | ✓This 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 notes | ✓Procedures 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 | ||||
| Claim | Unclaimed | Unclaimed | Unclaimed | Unclaimed |
Featured in
Signals
Loading live community signals…
A short, calm digest of reviewed Claude resources. Unsubscribe any time.