designing-api-principles

Design REST and GraphQL APIs with production best practices for naming, errors, versioning, and documentation.

3|Updated Jan 20, 2026
One-click install
npx skills add https://github.com/alunadev/ald-skills --skill designing-api-principles
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: designing-api-principles
Source: https://github.com/alunadev/ald-skills/tree/main/skills/api-design-principles
Command: npx skills add https://github.com/alunadev/ald-skills --skill designing-api-principles

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the challenge of creating APIs that are consistent, maintainable, and scalable by providing clear principles for REST and GraphQL design. It prevents costly rewrites by ensuring contracts are solid from the start.

Core Features & Use Cases

  • Resource Naming: Establishes conventions for clear and intuitive URL structures.
  • HTTP Status Codes & Error Handling: Ensures predictable and informative error responses.
  • Pagination & Filtering: Implements efficient data retrieval strategies.
  • Versioning: Guides on maintaining API evolution.
  • GraphQL Schema Design: Promotes schema-first development and N+1 prevention.
  • Use Case: When designing a new /users endpoint, this skill ensures proper resource naming, defines the expected request/response shapes, and specifies the correct HTTP status codes for various scenarios (e.g., 201 for creation, 400 for bad requests).

Quick Start

Use the designing-api-principles skill to design the API for a new /products resource, focusing on REST principles and defining its error cases.

Frequently Asked Questions about designing-api-principles

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

FAQPage Schema
What are the best practices for REST API resource naming and error handling?

REST API best practices involve establishing clear URL naming conventions and using predictable HTTP status codes for informative error responses. This ensures your endpoints remain consistent and maintainable across various scenarios like data creation or bad requests.

How do I design a GraphQL schema to prevent N+1 query issues?

Designing a GraphQL schema to prevent N+1 issues requires a schema-first development approach. By defining clear types and contracts upfront, you structure data retrieval efficiently to avoid redundant database queries during nested resolvers.

How do I implement API versioning and pagination for new endpoints?

Implementing API versioning and pagination involves defining strategies for API evolution and efficient data retrieval. Applying these principles when designing new endpoints ensures your backend services scale without requiring immediate refactoring.

What is the correct HTTP status code to return for a newly created resource?

The correct HTTP status code for a newly created resource is 201. Using precise HTTP status codes for API responses ensures predictable error handling and clear communication of operation results to API consumers.

Does this API design approach work for Next.js API routes and Supabase Edge Functions?

Yes, these API design principles apply directly to creating robust backend services including Next.js API routes and Supabase Edge Functions. Defining solid contracts early prevents costly rewrites when building these endpoints.

When should I establish project-wide API conventions to avoid refactoring?

You should establish project-wide API conventions before implementing new endpoints or writing API documentation. Defining contracts for resource naming, versioning, and authentication early prevents costly rewrites and ensures scalable backend services.