scaffold-route

Scaffold a Next.js route with tRPC router and Zod validation.

Updated Sep 12, 2021
One-click install
npx skills add https://github.com/cerico/macfair --skill scaffold-route
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: scaffold-route
Source: https://github.com/cerico/macfair/tree/main/files/claude/skills/scaffold-route
Command: npx skills add https://github.com/cerico/macfair --skill scaffold-route

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill automates scaffolding of a complete Next.js route with a tRPC router and Zod validation, delivering a standardized file structure for rapid feature bootstrapping.

Core Features & Use Cases

  • Generate a fully structured feature scaffold including app/[feature]/ with page.tsx, loading.tsx, error.tsx, and components/index.ts
  • Create server/api/routers/[feature]/index.ts with a tRPC router and a Zod-based validation layer
  • Update core project routing and validation barrels to integrate the new feature with a standard pattern
  • Use case: kick off a new feature by automatically bootstrapping the route, UI, API, and validation scaffolds

Quick Start

  1. Ask for the feature name (singular, lowercase, e.g., "project", "booking", "invoice")
  2. Ask which CRUD operations are needed: list, get, create, update, delete
  3. Generate files following the patterns below
  4. Update barrel exports and root router

Frequently Asked Questions about scaffold-route

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I scaffold a Next.js feature with tRPC and Zod validation?

To scaffold a Next.js feature with tRPC and Zod, provide a singular lowercase feature name and select CRUD operations. The tool generates page.tsx, loading.tsx, error.tsx, a tRPC router, and Zod validation, then updates barrel exports automatically.

What is the best way to bootstrap a Next.js tRPC router with Zod for a new feature?

Bootstrapping a Next.js tRPC router with Zod is best handled by generating a complete vertical slice. This creates app/[feature] components and server/api/routers/[feature] with validation, integrating everything into the root appRouter.

Do I need an existing tRPC setup to scaffold a Next.js route with validation?

Yes, you need an existing Next.js and tRPC setup. This scaffolding tool relies on your project's current configuration to generate the feature directory, update appRouter imports, and manage barrel validation exports correctly.

Can I generate specific CRUD operations when scaffolding tRPC routers in Next.js?

Yes, you can generate specific CRUD operations for tRPC routers in Next.js. When scaffolding, you choose which operations are needed: list, get, create, update, or delete, tailoring the generated Zod validation and API routes.

What files are included in a standard Next.js tRPC feature scaffold?

A standard Next.js tRPC feature scaffold includes app/[feature]/page.tsx, loading.tsx, error.tsx, and components/index.ts. It also creates server/api/routers/[feature]/index.ts with the tRPC router and Zod validation layer.