skills/backend/tech-trpc/SKILL.md
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.
npx skillsauth add ravnhq/ai-toolkit tech-trpcInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Type-safe remote procedure calls with full client-server type inference. No code generation needed. tRPC excels at:
unstable_pipe() for authentication, logging, authorizationTRPCError codes mapped to HTTP status automaticallyCore patterns: procedures (queries/mutations) in routers, input/output schemas for contracts, middleware for cross-cutting concerns, domain errors with proper codes.
When designing tRPC APIs:
invitations, payments, users).procedure.input().query()unstable_pipe()TRPCError with domain-specific codes, not plain ErrorPatterns are organized by concern:
See rules/ for implementation patterns and examples.
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.
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.
Error: Throwing plain Error in procedures
Cause: Plain errors become INTERNAL_SERVER_ERROR (500); clients cannot distinguish errors
Solution: Throw TRPCError with domain code: throw new TRPCError({ code: 'NOT_FOUND', message: '...' })
Error: Middlewares not chaining properly; context lost
Cause: Middlewares not piped with unstable_pipe(); context isolation between middleware layers
Solution: Use .unstable_pipe() to chain middleware and extend context
Error: Client receives generic "Input validation failed"
Cause: No custom errorFormatter configured; Zod errors not sent to client
Solution: Configure initTRPC.create({ errorFormatter }) to flatten Zod errors in response
Error: Middleware context not accessible in procedure
Cause: Middleware not piped or context not merged in opts.next()
Solution: Ensure middleware returns opts.next({ ctx: { ...prevCtx, newKey: value } })
Error: Procedure types leak into client; can import server code
Cause: Exporting procedure instance instead of type; typeof appRouter not used
Solution: Export only type AppRouter = typeof appRouter; client imports type only
testing
Transform user requests into detailed, precise prompts for AI models. Use when users say 'promptify', 'promptify this', 'rewrite this prompt', 'make this prompt better/more specific', or explicitly request prompt engineering or improvement of their request for better AI responses.
tools
Manage AI skills from the Ravn AI Toolkit via corvus CLI — install, update, remove, search, and configure skills for any project. Use when: (1) Installing AI skills into a project, (2) Updating installed skills to latest versions, (3) Browsing or searching available skills, (4) Configuring global or per-project skill sets, (5) Troubleshooting corvus setup. Triggers on: "install skills", "add skills", "update skills", "corvus", "skill manager", "browse skills", "set up AI rules".
development
Generate a gallery of design variations for a UI component. Takes an existing component (referenced by name, pasted code, or screenshot) and produces N distinct rendered alternatives in a single comparison page. Use when exploring visual directions, generating mockups, comparing design approaches for a component, creating A/B candidates, or when anyone says "show me options" or "give me variations" for a UI element.
tools
Create custom QA agent personalities for project-specific testing needs. Guided builder that asks about the specialty, tools, and test scenarios, then generates a personality file and registers it in the QA config. Trigger on "create a QA personality", "add a custom test agent", "build a webhook tester", or when the user needs a project-specific QA agent. Also triggered by /qa-create-personality.