What problem does it solve?
This Skill prevents fragmented or error-prone tRPC router implementations by standardizing router layout, procedure patterns, validation, error handling, and shared context construction.
Core Features & Use Cases
- Middleware-driven model injection: Centralizes model creation by injecting required models into
ctx via middleware so procedures stay clean and consistent.
- Reusable procedure patterns: Encourages uniform return shapes, zod input validation, and robust error handling that re-throws
TRPCError and wraps unexpected errors.
- Performance-friendly aggregated detail endpoints: Provides a pattern for parallel data fetching (e.g.,
Promise.all) to avoid N sequential API calls from clients.
- Use cases: Implementing or extending server-side API endpoints in
src/server/routers/lambda/**, adding query/mutation procedures, and composing endpoints for views that require multiple related entities.
Quick Start
Use the trpc-router skill to guide you when you create a new router file under src/server/routers/lambda/ and implement procedures that inject models through middleware, validate inputs with zod, and return consistent { data, success: true } / { data?, message, success: true } shapes.