Agent skill
api-endpoint-scaffolder
Generate REST API endpoints with proper structure, validation, error handling, and types. Use when creating new API routes, endpoints, or backend services.
Install this agent skill to your Project
npx add-skill https://github.com/OneWave-AI/claude-skills/tree/main/api-endpoint-scaffolder
SKILL.md
API Endpoint Scaffolder
Instructions
When creating a new API endpoint:
- Identify the framework (Express, Next.js, FastAPI, etc.)
- Determine HTTP method (GET, POST, PUT, PATCH, DELETE)
- Define request/response types
- Implement with best practices
Templates
Next.js App Router (TypeScript)
// app/api/[resource]/route.ts
import { NextRequest, NextResponse } from 'next/server';
import { z } from 'zod';
const RequestSchema = z.object({
// Define your schema
});
export async function GET(request: NextRequest) {
try {
const { searchParams } = new URL(request.url);
// Implementation
return NextResponse.json({ data }, { status: 200 });
} catch (error) {
console.error('[API] Error:', error);
return NextResponse.json(
{ error: 'Internal server error' },
{ status: 500 }
);
}
}
export async function POST(request: NextRequest) {
try {
const body = await request.json();
const validated = RequestSchema.parse(body);
// Implementation
return NextResponse.json({ data }, { status: 201 });
} catch (error) {
if (error instanceof z.ZodError) {
return NextResponse.json(
{ error: 'Validation failed', details: error.errors },
{ status: 400 }
);
}
return NextResponse.json(
{ error: 'Internal server error' },
{ status: 500 }
);
}
}
Express (TypeScript)
import { Router, Request, Response, NextFunction } from 'express';
import { z } from 'zod';
const router = Router();
const CreateSchema = z.object({
// Define schema
});
router.post('/', async (req: Request, res: Response, next: NextFunction) => {
try {
const data = CreateSchema.parse(req.body);
// Implementation
res.status(201).json({ success: true, data });
} catch (error) {
next(error);
}
});
export default router;
Best Practices
- Always validate input using Zod, Yup, or similar
- Use proper HTTP status codes:
- 200: Success
- 201: Created
- 400: Bad Request
- 401: Unauthorized
- 403: Forbidden
- 404: Not Found
- 500: Server Error
- Log errors but don't expose internals to clients
- Use consistent response format
- Add rate limiting for public endpoints
- Document with OpenAPI/Swagger when possible
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
webinar-to-content-multiplier
Convert webinar recordings into blog posts, social snippets, email series. Extract key quotes, statistics, and soundbites.
champion-identifier
Analyze LinkedIn profiles in target accounts to identify potential internal champions. Evaluates role, career path, mutual connections, interests, and suggests personalization approach. Use when you need to find who will champion your solution internally.
skill-navigator
The 100th skill! Your intelligent guide to all 99 other skills. Recommends the perfect skill for any task, creates skill combinations, and helps you discover capabilities you didn't know you had.
presentation-design-enhancer
Transform text-heavy slides into visual storytelling. Suggest layout improvements, icon usage, and data visualization.
quiz-maker
Create multiple choice, true/false, fill-in-blank, matching quizzes. Auto-generate plausible distractors. Instant grading with explanations.
error-boundary-creator
Create error boundaries, error handling, and fallback UIs for React applications. Use when implementing error handling, creating fallback components, or setting up error reporting.
Didn't find tool you were looking for?