skills/api-routes/SKILL.md
Next.js API Routes - Route handlers, middleware, edge runtime
npx skillsauth add pluginagentmarketplace/custom-plugin-nextjs api-routesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Build API endpoints with Next.js Route Handlers and middleware.
// app/api/users/route.ts
import { NextResponse } from 'next/server'
export async function GET() {
const users = await db.users.findMany()
return NextResponse.json(users)
}
export async function POST(request: Request) {
const body = await request.json()
const user = await db.users.create(body)
return NextResponse.json(user, { status: 201 })
}
// app/api/users/[id]/route.ts
export async function GET(
request: Request,
{ params }: { params: { id: string } }
) {
const user = await db.users.findById(params.id)
return NextResponse.json(user)
}
// middleware.ts
export function middleware(request: NextRequest) {
const token = request.cookies.get('token')
if (!token) {
return NextResponse.redirect(new URL('/login', request.url))
}
}
devops
Next.js deployment - Vercel, Docker, self-hosting strategies
data-ai
Next.js data fetching - Server actions, caching, revalidation
tools
Next.js App Router - Server components, layouts, routing patterns
development
Master modern web development. Learn HTML/CSS/JavaScript fundamentals, React/Vue/Angular frameworks, Node.js backend, databases, APIs, and full-stack architectures. Use when building web applications, learning web technologies, or choosing tech stacks.