API Route Conventions

Enforces RESTful API route conventions for Next.js apps with Clerk and Supabase.

Updated Apr 30, 2026
One-click install
npx skills add https://github.com/bytetalent/docs --skill api-route-conventions-bytetalent
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: API Route Conventions
Source: https://github.com/bytetalent/docs/tree/main/skills/api/api-route-conventions
Command: npx skills add https://github.com/bytetalent/docs --skill api-route-conventions-bytetalent

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill addresses the challenge of maintaining consistent and secure API route conventions across different projects, ensuring a high standard of code quality and security.

Core Features & Use Cases

  • REST-only Routes: Enforces the use of REST for API routes, simplifying client-server communication.
  • File Layout: Defines clear file paths for list and detail endpoints, enhancing code organization.
  • Auth Guard Order: Outlines the correct sequence for authentication checks to ensure secure access control.
  • CORS Rules: Provides guidelines for handling Cross-Origin Resource Sharing to maintain security.
  • Health Check Endpoint: Offers a standardized health-check endpoint for application monitoring.
  • Use Case: Implement this Skill to structure your Next.js API routes following best practices, ensuring your API is secure and maintainable.

Quick Start

Implement the API route conventions for your Next.js application by following the outlined file layout and authentication sequence in your src/app/api/ directory.

Frequently Asked Questions about API Route Conventions

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

FAQPage Schema
How do I structure Next.js API routes for list and detail endpoints?

To structure Next.js API routes, define clear file paths in your `src/app/api/` directory to separate list and detail endpoints, ensuring RESTful conventions and enhancing code organization for maintainable client-server communication.

What is the correct authentication guard order for Next.js API routes?

The correct authentication guard order outlines a specific sequence for authentication checks before processing requests. Following this sequence ensures secure access control when integrating auth providers like Clerk and Supabase.

Can I use this to enforce REST-only API conventions in a Next.js application?

Yes, you can enforce REST-only API conventions in a Next.js application. This approach simplifies client-server communication by strictly enforcing RESTful standards for all API route interactions and code generation.

How do I configure CORS rules for secure API interactions in Next.js?

To configure CORS rules for secure API interactions, apply the provided Cross-Origin Resource Sharing guidelines. These rules maintain security by controlling how external domains access your Next.js API routes.

Does this API route convention work with Clerk and Supabase?

Yes, this API route convention works with Clerk and Supabase. It is specifically applicable to Next.js applications using these services, focusing on secure code generation and authentication sequencing.

What is the best way to implement a standardized health check endpoint in Next.js?

The best way to implement a standardized health check endpoint is to follow the outlined file layout within your `src/app/api/` directory. This offers a standardized endpoint for consistent application monitoring.