api-new
БесплатноБез исполняемых скриптовНе проверенCreate a new Next.js API route with validation, error handling, and TypeScript
от diegosouzapw★ 68 звёзд на GitHubОб этом скилле
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
anytypes
5. Security
- Input sanitization
- CORS configuration if needed
- Rate limiting considerations
- Authentication/authorization checks
6. Response Format
// Success
{ data: T, success: true }
// Error
{ error: string, details?: unknown, success: false }
Code Structure
Create a complete API route with:
- Route Handler File -
app/api/[route]/route.ts - Validation Schema - Zod schemas for request/response
- Type Definitions - Shared TypeScript types
- Error Handler - Centralized error handling
- Example Usage - Client-side fetch example
Best Practices to Follow
- Early validation before expensive operations
- Proper HTTP status codes (200, 201, 400, 401, 404, 500)
- Consistent error response format
- TypeScript strict mode
- Minimal logic in routes (use services/utils)
- Environment variable validation
- Request/response logging for debugging
- No sensitive data in responses
- No database queries without validation
- No inline business logic (extract to services)
Generate production-ready code that I can immediately use in my Next.js project.
Установить api-new в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл api-new?
Create a new Next.js API route with validation, error handling, and TypeScript
Как установить скилл api-new?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл api-new запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic