api-routes

Implement Next.js API route handlers and middleware for app/api endpoints.

3|Updated Nov 18, 2025
One-click install
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-nextjs --skill api-routes-pluginagentmarketplace
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-routes
Source: https://github.com/pluginagentmarketplace/custom-plugin-nextjs/tree/main/skills/api-routes
Command: npx skills add https://github.com/pluginagentmarketplace/custom-plugin-nextjs --skill api-routes-pluginagentmarketplace

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires yaml, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

Next.js API routes are powerful yet crafting route handlers, middleware, and edge-runtime configurations can be verbose and error-prone. This Skill provides a concise blueprint to build and maintain Next.js API Routes efficiently.

Core Features & Use Cases

  • Route Handlers: define GET, POST, PUT, PATCH, DELETE for app/api.
  • Middleware: add authentication, logging, and edge-runtime processing.
  • Use Case: scaffold endpoints for resources like users or products with reusable patterns.

Quick Start

Use the api-routes skill to scaffold an endpoint at app/api/users/route.ts with a GET that returns a users list.

Frequently Asked Questions about api-routes

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create Next.js API route handlers for multiple HTTP methods?

Next.js API route handlers define GET, POST, PUT, PATCH, and DELETE methods within the app/api directory. This Skill scaffolds these TypeScript endpoints using reusable patterns for scalable API design.

How do I add middleware for authentication and logging in Next.js app/api routes?

Middleware in Next.js app/api routes handles authentication, logging, and edge-runtime processing. This Skill provides blueprints to inject these interceptors efficiently for scalable API design.

Does this API routing approach support Next.js edge-runtime?

Yes, the approach supports Next.js edge-runtime. It targets edge-runtime usage within route handlers and middleware to process requests efficiently at the edge for scalable API design.

What is the best way to scaffold a scalable Next.js API endpoint for a resource?

The best way to scaffold a scalable Next.js API endpoint is using a standard skill structure with YAML configuration and validation scripts. This generates reusable TypeScript route handlers for resources like products.

Why does configuring Next.js API routes manually result in errors?

Configuring Next.js API routes manually is verbose and error-prone due to repetitive TypeScript handler definitions and edge-runtime setups. This Skill enforces a standard structure with validation scripts to prevent these errors.