Agent skill · Backend & API

add-api-route

Create Next.js API route with validation and error handling

majiayu000github.com/majiayu000GitHub ↗
claude-codeMIT
Install
npx skills add majiayu000/claude-skill-registry --skill add-api-route --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 2
SKILL.md size: 3 KB
Bundled scripts: none
Path: skills/api/add-api-route/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 534
Language: HTML

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Add API Route: $ARGUMENTS Create a Next.js API route with proper validation, error handling, and types. ## Process ### 1. Determine Route Structure Parse arguments to determine: - Route path (e.g., `users`, `posts/[id]`) - HTTP methods (GET, POST, PUT, DELETE) - Dynamic segments if any ### 2. Create Route File **App Router (Next.js 13+):** ``` app/api/[route]/route.ts ``` **Pages Router:** ``` pages/api/[route].ts ``` ### 3. Generate Route Handler **App Router template:** ```typescript import { NextRequest, NextResponse } from 'next/server'; // Types interface RequestBody { // define expected body shape } interface ResponseData { // define response shape } // GET handler export async function GET(request: NextRequest) { try { // Implementation return NextResponse.json({ data: [] }); } catch (error) { console.error('GET error:', error); return NextResponse.json( { error: 'Internal server error' }, { status: 500 } ); } } // POST handler export async function POST(request: NextRequest) { try { const body: RequestBody = await request.json(); // Validate if (!body.requiredField) { return NextResponse.json( { error: 'Missing required field' }, { status: 400 } ); } // Implementation ret

What's inside
Steps it walks through
  1. Process
  2. 1. Determine Route Structure
  3. 2. Create Route File
  4. 3. Generate Route Handler
  5. 4. Add Type Definitions
  6. 5. Create Tests
  7. 6. Validate
  8. Patterns
Ships with 1 file
  • metadata.json
Commands it runs
npm run build
npm test
More from claude-skill-registry
All skills →
About this skill
What does the add-api-route skill do?

Create Next.js API route with validation and error handling

How do I install it?

Run `npx skills add majiayu000/claude-skill-registry --skill add-api-route --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.

Keep going