new-route

Scaffold Next.js API routes with Zod validation and session checks.

1|1|Updated Mar 12, 2026
One-click install
npx skills add https://github.com/bettercallzaal/ZAOOS --skill new-route-bettercallzaal
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: new-route
Source: https://github.com/bettercallzaal/ZAOOS/tree/main/.claude/skills/new-route
Command: npx skills add https://github.com/bettercallzaal/ZAOOS --skill new-route-bettercallzaal

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This API route scaffolder eliminates repetitive boilerplate by generating a Next.js route scaffold that adheres to ZAO OS conventions (Zod validation, session-based auth, NextResponse, and structured error handling).

Core Features & Use Cases

  • Automated route scaffolding: Produces a ready-to-use src/app/api/$ARGUMENTS/route.ts that follows ZAO OS patterns.
  • Enforced best practices: Ensures input validation with Zod, session checks via getSession, comprehensive try/catch, and safe NextResponse.json responses.
  • Use Case: Quickly bootstrap new resources like /new-route music/favorites for consistent, secure endpoints across projects.

Quick Start

Create a new API route scaffold by invoking the CLI with a target path, e.g. music/favorites.

Frequently Asked Questions about new-route

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

FAQPage Schema
How do I scaffold a Next.js API route with Zod validation and session authentication?

You can scaffold a Next.js API route with Zod validation and session authentication by generating a route.ts file that enforces input validation with zod.safeParse, authorizes requests via getSession, and wraps logic in a global try/catch block.

What's the best way to standardize secure API responses in Next.js?

The best way to standardize secure API responses in Next.js is to use a scaffolded route template that enforces NextResponse.json returns and safe error handling, preventing inconsistent or unsanitized data leaks across backend endpoints.

Does this API scaffolder support both GET and mutation request templates?

Yes, the API scaffolder supports both GET and mutation templates. It generates ready-to-use route logic that enforces authorization checks and input validation for standard data retrieval and state-changing operations.

How do I eliminate Next.js backend boilerplate when creating new resources?

You eliminate Next.js backend boilerplate by using a scaffolder to generate a route.ts file following strict conventions. It automatically implements Zod validation, session checks, and error handling, bypassing manual boilerplate coding.

Can I use this route scaffolder for rapid backend development across multiple endpoints?

Yes, you can use this route scaffolder for rapid backend development across multiple endpoints. It allows you to quickly bootstrap new resources like music/favorites with consistent security and validation patterns across projects.

Why should I use zod.safeParse instead of standard parsing for API input validation?

You should use zod.safeParse for API input validation because it safely validates incoming request data without throwing runtime errors. The scaffolded route integrates this within a global try/catch block to ensure structured, safe error handling.