بنقرة واحدة
api-design
Design and implement RESTful APIs with proper patterns, validation, and documentation.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Design and implement RESTful APIs with proper patterns, validation, and documentation.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Migrate from Next.js 15 to Next.js 16 and handle breaking changes
Configure Content Security Policy and security headers for the portfolio
Deploy Next.js to Cloudflare Workers using OpenNext adapter
Manage the canary token honeypot system for detecting security scanning
Write, debug, and optimize GROQ queries for Sanity CMS in this portfolio
Advanced TypeScript patterns and type safety as used in this portfolio
| name | api-design |
| description | Design and implement RESTful APIs with proper patterns, validation, and documentation. |
Design and implement robust RESTful APIs following industry best practices for the portfolio's Next.js API routes.
{ success: boolean, data?: T, error?: string }// app/api/resource/route.ts
import { NextRequest, NextResponse } from 'next/server';
import { z } from 'zod';
const ResourceSchema = z.object({
name: z.string().min(1),
// ...
});
export async function GET(request: NextRequest) {
try {
// Implementation
return NextResponse.json({ success: true, data: result });
} catch (error) {
return NextResponse.json(
{ success: false, error: 'Internal server error' },
{ status: 500 }
);
}
}
export async function POST(request: NextRequest) {
try {
const body = await request.json();
const validated = ResourceSchema.parse(body);
// Implementation
return NextResponse.json({ success: true, data: result }, { status: 201 });
} catch (error) {
if (error instanceof z.ZodError) {
return NextResponse.json(
{ success: false, error: 'Validation failed', details: error.errors },
{ status: 400 }
);
}
return NextResponse.json(
{ success: false, error: 'Internal server error' },
{ status: 500 }
);
}
}