api-route-scaffold
Create new Next.js API routes following project patterns. Use when user mentions "new endpoint", "add API", "create route", or "POST/GET handler".
npx skills add majiayu000/claude-skill-registry --skill api-route-scaffold-applelamps-grokify --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Creating API Routes This project uses Next.js 16 App Router with a consistent API pattern across all routes. ## Instructions 1. **Create route file**: `app/api/<endpoint-name>/route.ts` 2. **Use this template**: ```typescript import { NextRequest, NextResponse } from 'next/server'; // CORS headers for cross-origin requests const corsHeaders = { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey, content-type', }; export async function OPTIONS() { return NextResponse.json(null, { headers: corsHeaders }); } export async function POST(req: NextRequest) { try { const { /* destructure fields */ } = await req.json(); // Input validation if (!requiredField) { return NextResponse.json( { error: 'Field is required' }, { status: 400, headers: corsHeaders } ); } // Check required environment variables const apiKey = process.env.YOUR_API_KEY; if (!apiKey) { console.error('YOUR_API_KEY is not configured'); return NextResponse.json( { error: 'YOUR_API_KEY is not configured' }, { status: 500, headers: corsHeaders } ); } // Business logic here const result = await doSomething(); return NextResponse.json({ result }, { headers: corsHeaders });
- Instructions
- Existing Endpoints Reference
- Examples
- Guardrails
What does the api-route-scaffold skill do?
Create new Next.js API routes following project patterns. Use when user mentions "new endpoint", "add API", "create route", or "POST/GET handler".
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill api-route-scaffold-applelamps-grokify --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
