Tech trpc

From ravnhq/ai-toolkit · View interactive version

Tech trpc is an AI agent skill from the GitHub repository ravnhq/ai-toolkit. tRPC end-to-end typesafe APIs. Router architecture, procedure design, middleware chaining, input validation with Zod, error handling, and Vertical Slice Architecture. Use when building tRPC APIs, designing procedures, structuring backend slices, or handling cross-procedure logic.

How to use this skill

Skill file

tRPC End-to-End Typesafe APIs

Type-safe remote procedure calls with full client-server type inference. No code generation needed. tRPC excels at:

Core patterns: procedures (queries/mutations) in routers, input/output schemas for contracts, middleware for cross-cutting concerns, domain errors with proper codes.

Workflow

When designing tRPC APIs:

  1. Define the slice — Which feature? (e.g., invitations, payments, users)
  2. Schema first — Input schema with Zod, output schema for response contract
  3. Create procedures — Query, mutation, or subscription with .procedure.input().query()
  4. Add middleware — Authentication, logging, authorization; chain with unstable_pipe()
  5. Error handling — Throw TRPCError with domain-specific codes, not plain Error
  6. Organize — One file per procedure; repository per slice; no cross-slice imports

Rules

Patterns are organized by concern:

See rules/ for implementation patterns and examples.

Examples

Positive Trigger

User: "Add a tRPC mutation for creating invoices with Zod input validation."

Expected behavior: Use tech-trpc guidance, apply procedure design with Zod schema and proper error handling.

Non-Trigger

User: "Write a Python Flask endpoint for file uploads."

Expected behavior: Do not prioritize tech-trpc; choose a more relevant skill or proceed without it.

Troubleshooting

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.