api-new
Create a new Next.js API route with validation, error handling, and TypeScript
npx skills add majiayu000/claude-skill-registry --skill api-new --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.
# 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
- Requirements
- Implementation Guidelines
- 1. Next.js 15 App Router (Recommended)
- 2. Validation
- 3. Error Handling
- 4. TypeScript
- 5. Security
- 6. Response Format
- Code Structure
- Best Practices to Follow
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.
