moai-ref-api-patterns

Provides REST and GraphQL API design conventions, error formats, and validation checklists for backend development.

Updated Aug 29, 2026
One-click install
npx skills add https://github.com/Seung-zedd/secure-file-upload --skill moai-ref-api-patterns-seung-zedd
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: moai-ref-api-patterns
Source: https://github.com/Seung-zedd/secure-file-upload/tree/main/.claude/skills/moai-ref-api-patterns
Command: npx skills add https://github.com/Seung-zedd/secure-file-upload --skill moai-ref-api-patterns-seung-zedd

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Backend developers often ship APIs with inconsistent naming, ad-hoc error responses, missing pagination, and unplanned versioning, which creates maintenance burden and breaks client integrations. This reference consolidates production-grade API design conventions into a single decision guide. ## Core Features & Use Cases - RESTful Design Conventions: Resource naming, HTTP method semantics, status code selection, filtering, sorting, and nested resource rules. - Standardized Error & Pagination Formats: Machine-readable error codes with request IDs, plus offset and cursor-based pagination patterns. - Validation, Rate Limiting & Versioning Guidance: Input validation checklist, rate limit targets per endpoint type, and breaking vs non-breaking change classification. - Use Case: When implementing a new /api/v1/users endpoint, consult the conventions table to pick correct status codes, structure the error response, and add pagination before writing handler code. ## Quick Start Ask the agent to review your API endpoint design against REST conventions for naming, error handling, and pagination.

Frequently Asked Questions about moai-ref-api-patterns

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

FAQPage Schema
How do I design RESTful API endpoints with correct naming conventions?▼

Use plural nouns in lowercase kebab-case for resources, such as /api/v1/user-profiles. Map CRUD operations to HTTP methods: POST creates, GET reads, PUT replaces, PATCH partially updates, and DELETE removes. Keep nested resources to a maximum of two levels deep.

What HTTP status codes should API endpoints return?▼

Return 200 for successful reads and updates, 201 for resource creation, and 204 for deletions without a body. Use 400 for validation failures, 401 for missing authentication, 403 for insufficient authorization, 404 for missing resources, 409 for conflicts, and 429 for rate limiting.

How should API error responses be structured?▼

Return a JSON object with a machine-readable error code, a human-readable message, field-level details array, and a request_id for traceability. Never expose stack traces in production, and use generic messages like "Invalid email or password" for login failures.

When should I use cursor-based vs offset pagination?▼

Use offset pagination with page and limit parameters for typical datasets where total counts matter. Use cursor-based pagination for large datasets where offset performance degrades, returning an opaque next cursor and a has_more flag instead of page numbers.

What API changes require a version bump?▼

Breaking changes require a version bump: removing or renaming fields, changing field types, removing endpoints, or changing authentication methods. Adding optional fields, new endpoints, or new query parameters are non-breaking and need no version change.

When is this API patterns reference not applicable?▼

It does not cover frontend development, DevOps, database schema design, or security audits. It focuses specifically on API design conventions, error handling, and input validation for backend endpoint implementation and review.