Agent skill · Backend & API

api-new

Create a new Next.js API route with validation, error handling, and TypeScript

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

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

Facts
Files in the skill folder: 2
SKILL.md size: 2 KB
Bundled scripts: none
Path: skills/api/api-new/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

# Create New API Route Create a new Next.js API route following modern best practices for solo developers. ## Requirements API Endpoint: $ARGUMENTS ## Implementation Guidelines ### 1. **Next.js 15 App Router** (Recommended) Use Route Handlers in `app/api/` directory with TypeScript ### 2. **Validation** - Use Zod for runtime type validation - Validate input early (before DB/API calls) - Return clear validation error messages ### 3. **Error Handling** - Global error handling with try/catch - Consistent error response format - Appropriate HTTP status codes - Never expose sensitive error details ### 4. **TypeScript** - Strict typing for requests/responses - Shared type definitions - No `any` types ### 5. **Security** - Input sanitization - CORS configuration if needed - Rate limiting considerations - Authentication/authorization checks ### 6. **Response Format** ```typescript // Success { data: T, success: true } // Error { error: string, details?: unknown, success: false } ``` ## Code Structure Create a complete API route with: 1. **Route Handler File** - `app/api/[route]/route.ts` 2. **Validation Schema** - Zod schemas for request/response 3. **Type Definitions** - Shared TypeScript

What's inside
Steps it walks through
  1. Requirements
  2. Implementation Guidelines
  3. 1. Next.js 15 App Router (Recommended)
  4. 2. Validation
  5. 3. Error Handling
  6. 4. TypeScript
  7. 5. Security
  8. 6. Response Format
  9. Code Structure
  10. Best Practices to Follow
Ships with 1 file
  • metadata.json
More from claude-skill-registry
All skills →
About this skill
What does the api-new skill do?

Create a new Next.js API route with validation, error handling, and TypeScript

How do I install it?

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