nextjs-route-generator
Installation
SKILL.md
Next.js Route Generator
Before generating any output, read config/defaults.md and adapt all patterns, imports, and code examples to the user's configured stack.
Generation Process
- Determine the route path and HTTP methods needed
- Generate route handler with proper exports (GET, POST, PUT, PATCH, DELETE)
- Add Zod schemas for request validation
- Include structured error handling
- Export TypeScript types for frontend consumption
Route Structure
Place routes in app/api/ following Next.js App Router conventions:
app/api/users/route.ts→/api/usersapp/api/users/[id]/route.ts→/api/users/:idapp/api/posts/[postId]/comments/route.ts→/api/posts/:postId/comments