Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new trpc-router skill that scaffolds a CRUD-style tRPC v11 router (optionally including Drizzle schema + Vitest tests) using markdown-based TypeScript templates.
Changes:
- Introduces
skills/trpc-router/SKILL.mddefining CLI options, guided flow, and scaffolding steps. - Adds router/schema/test markdown templates under
skills/trpc-router/templates/for code generation.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| skills/trpc-router/SKILL.md | Defines the skill workflow (parsing, guided mode, file generation order, constraints). |
| skills/trpc-router/templates/router.md | Template for generating a tRPC router module for an entity. |
| skills/trpc-router/templates/schema.md | Template for appending a Drizzle table + Zod schemas into a central schema.ts. |
| skills/trpc-router/templates/test.md | Template for generating a Vitest CRUD test file for the router. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+72
to
+74
| const [updated] = await db.select().from(<Entity>).where(eq(<Entity>.id, record.id)); | ||
| expect(updated?./* updated field */).toBe(/* expected value */); | ||
| }); |
| import type { TRPCRouterRecord } from "@trpc/server"; | ||
| import { z } from "zod/v4"; | ||
|
|
||
| import { desc, eq } from "@acme/db"; // desc: only if 'all' is included; eq: always |
| - `<Entity>` → PascalCase (e.g. `ProductVariant`) | ||
| - `<entity>` → camelCase (e.g. `productVariant`) | ||
|
|
||
| Fill `/* required fields */` with the actual column values needed to satisfy the schema's non-nullable constraints. Use valid RFC 4122 UUIDs for all UUID fields — never bare strings like `"test-uuid"` or zero-padded strings like `"00000000-0000-4000-8000-000000000001"` (the 3rd group must start with `[1-8]` for version, 4th group with `[89ab]` for variant). Use the pattern `"00000000-0000-4000-8000-00000000000X"` for readable test fixtures. |
Comment on lines
+60
to
+63
| const records = await db.select().from(<Entity>); | ||
| expect(records).toHaveLength(1); | ||
| expect(records[0]?./* field */).toBe(/* expected value */); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
/trpc-routerskill that scaffolds complete tRPC v11 routers for a named entity, including optional schema append and test generation support. The skill is designed to be practical for monorepo API workflows and includes strict guardrails for naming, auth mode selection, procedure subsets, and generation order.Changes
Added
skills/trpc-router/SKILL.md(new, 224 lines)/trpc-router <entity> [options]usage with--helpoutput--guidedmode and non-interactive argument parsing--procedures(all,query,mutation, or explicit subset)--auth(mixed,public,protected)--with-schemaand--no-testsany,zod/v4, import ordering, etc.)Added
skills/trpc-router/templates/router.md(new, 53 lines)<Entity>,<entity>, and entity-kebab file namingAdded
skills/trpc-router/templates/schema.md(new, 39 lines)packages/db/src/schema.tsAdded
skills/trpc-router/templates/test.md(new, 87 lines)Technical Details
Testing
--helpreturns expected usage text and exits without scaffoldingmixed/public/protected) applies correctly--with-schemapath appends schema only after collecting column inputBreaking Changes
None expected. This PR adds a new skill and templates only; existing skills and rules are unchanged.