api-route-scaffold

Scaffolds Next.js API routes with OPTIONS/POST handlers, CORS, and error handling.

1|Updated Dec 27, 2025
One-click install
npx skills add https://github.com/AppleLamps/xpic2 --skill api-route-scaffold
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-route-scaffold
Source: https://github.com/AppleLamps/xpic2/tree/main/.claude/skills/api-route-scaffold
Command: npx skills add https://github.com/AppleLamps/xpic2 --skill api-route-scaffold

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a proven blueprint for scaffolding Next.js API routes with consistent structure (OPTIONS, POST handlers), CORS, and error handling.

Core Features & Use Cases

  • Route scaffold: create app/api/<endpoint-name>/route.ts following project pattern
  • CORS & error handling: standard preflight handling and robust error responses
  • Database patterns: guidelines for importing from @/db and using drizzle

Quick Start

Create app/api/<endpoint-name>/route.ts using the template and adapt the fields, then wire it to your data model and API.