trpc-scaffolder
Scaffolds tRPC routers, procedures, and Zod schemas with full type safety following DevPrep AI patterns
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Scaffolds tRPC routers, procedures, and Zod schemas with full type safety following DevPrep AI patterns
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Understand and navigate the DevPrep AI 7-folder architecture. Use this skill when asked about code organization, where to place new features, what modules exist, or when starting development tasks that need architecture context. Auto-triggers on keywords like "where should", "add module", "architecture", "structure", "organize", "place code", "what modules".
Creates beautiful ASCII art visualizations for plans, architectures, workflows, and data. This skill should be used when explaining system architecture, creating implementation plans, showing workflows, visualizing comparisons, or documenting file structures. NOT for code syntax highlighting or markdown tables. User explicitly loves ASCII art - use liberally for visual communication.
Automatically reviews DevPrep AI code for quality standards including ESLint compliance, TypeScript strict mode, 180-line file limits, complexity under 15, proper naming conventions, import patterns, and architectural compliance with the 6-folder structure
Use when creating or developing anything, before writing code or implementation plans - refines rough ideas into fully-formed designs through structured Socratic questioning, alternative exploration, and incremental validation
Guided workflow for implementing HTML design prototypes as production React components with glassmorphism styling and quality standards enforcement. Use when converting design prototypes to production code.
Scaffolds new feature modules in DevPrep AI following the 6-folder architecture with proper TypeScript interfaces, path aliases, and quality standards. Use when creating new domains like 'analytics', 'notifications', or any new feature module.
| name | trpc-scaffolder |
| description | Scaffolds tRPC routers, procedures, and Zod schemas with full type safety following DevPrep AI patterns |
| allowed-tools | ["Read","Write","Edit","Bash","Glob","Grep"] |
Automate creation of type-safe tRPC endpoints with Zod validation.
TL;DR: Run scripts to create routers/schemas, register in _app.ts, validate with scripts.
Auto-triggered by keywords:
lib/trpc/routers/
_app.ts # Register all routers here ⚠️
{name}.ts # Router files
lib/trpc/schemas/
{entity}.schema.ts # Zod schemas
export const nameRouter = router({
doThing: publicProcedure
.input(inputSchema)
.output(outputSchema)
.mutation(async ({ input }) => { /* logic */ }),
});
export const inputSchema = z.object({
field: z.string().min(1),
});
export type Input = z.infer<typeof inputSchema>; // ⚠️ Required!
// In _app.ts
export const appRouter = router({
ai: aiRouter,
name: nameRouter, // ⬅️ Add new routers here
});
./.claude/skills/trpc-scaffolder/scripts/create-router.sh user
# Creates: lib/trpc/routers/user.ts
# ⚠️ Remember to register in _app.ts!
./.claude/skills/trpc-scaffolder/scripts/add-procedure.sh ai getHints query
# Outputs code snippet to add to router
./.claude/skills/trpc-scaffolder/scripts/create-schema.sh hint
# Creates: lib/trpc/schemas/hint.schema.ts
./.claude/skills/trpc-scaffolder/scripts/validate-trpc.sh
# Checks: router registration, type exports
| Type | Use For | Method |
|---|---|---|
| Query | Fetch data (GET) | .query(async ({ input }) => ...) |
| Mutation | Modify data (POST/PUT/DELETE) | .mutation(async ({ input }) => ...) |
| Type | Pattern | Example |
|---|---|---|
| String | z.string().min(1).max(100) | Name validation |
| Number | z.number().int().min(0).max(10) | Difficulty 0-10 |
z.string().email() | Email validation | |
| Optional | z.string().optional() | Optional field |
| Array | z.array(z.string()).min(1) | At least 1 item |
| Enum | z.enum(["a", "b", "c"]) | Fixed choices |
| Object | z.object({ field: z.string() }) | Nested object |
{domain}Router (e.g., aiRouter, userRouter)camelCase (e.g., generateQuestions, getHints){action}{Entity}{Input\|Output}Schema{entity}.schema.ts, {domain}.ts| Code | When | Example |
|---|---|---|
NOT_FOUND | Resource doesn't exist | User not found |
BAD_REQUEST | Invalid input | Validation failed |
UNAUTHORIZED | Not authenticated | Login required |
FORBIDDEN | Not authorized | Access denied |
INTERNAL_SERVER_ERROR | Server error | API failure |
// ❌ Forgot this step
// ✅ Add to _app.ts:
import { userRouter } from "./user";
export const appRouter = router({ ai: aiRouter, user: userRouter });
// ❌ Schema without types
export const userSchema = z.object({ name: z.string() });
// ✅ Always export inferred types
export type User = z.infer<typeof userSchema>;
// ❌ Using mutation for fetching data
getData: publicProcedure.mutation(...)
// ✅ Use query for GET operations
getData: publicProcedure.query(...)
// ❌ No validation
field: z.string()
// ✅ Add constraints
field: z.string().min(1, "Field is required")
SKILL.md is self-sufficient for:
Load additional docs when needed:
| Need | Load |
|---|---|
| Step-by-step tutorial | docs/quick-start-guide.md |
| Advanced Zod patterns | docs/trpc-patterns.md (lines 1-80) |
| Error handling strategies | docs/trpc-patterns.md (lines 150-220) |
| Testing procedures | docs/trpc-patterns.md (lines 220-270) |
| Context & middleware | docs/trpc-patterns.md (lines 80-150) |
Code examples:
examples/good-router.ts, examples/good-schema.tsFull project docs: Docs/api-design.md, Docs/api-transition/trpc-migration.md
Version: 1.0.0 | Updated: October 2025 Pattern: Follows quality-reviewer structure (optimized)