Backend API

Design RESTful API endpoints with HTTP methods, versioning, and rate limiting.

Updated Mar 13, 2023
One-click install
npx skills add https://github.com/pdovhomilja/dovhomilja-cz --skill backend-api-pdovhomilja
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Backend API
Source: https://github.com/pdovhomilja/dovhomilja-cz/tree/main/.claude/skills/backend-api
Command: npx skills add https://github.com/pdovhomilja/dovhomilja-cz --skill backend-api-pdovhomilja

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill ensures backend APIs are designed following REST principles, providing clear, consistent, and maintainable endpoints for seamless client-server communication, accelerating frontend development and improving system integration.

Core Features & Use Cases

  • RESTful Design: Implement resource-based URLs, appropriate HTTP methods (GET, POST, PUT, DELETE), and clear request/response structures.
  • API Consistency: Define consistent API versioning strategies, query parameters for filtering/pagination, and HTTP status codes.
  • Security & Performance: Implement rate limiting and secure API practices.
  • Use Case: When creating an API for managing user accounts, this skill guides the AI to define endpoints like /api/users (GET, POST) and /api/users/{id} (GET, PUT, DELETE), ensuring proper HTTP methods, status codes, and query parameters are used for filtering.

Quick Start

Create a new RESTful API endpoint /api/products that supports GET to retrieve all products and POST to create a new product, returning appropriate HTTP status codes and following REST principles.

Frequently Asked Questions about Backend API

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

FAQPage Schema
How do I design RESTful API endpoints with proper HTTP methods?

RESTful API design uses resource-based URLs with appropriate HTTP methods: GET to retrieve, POST to create, PUT to update, DELETE to remove. Define endpoints like `/api/resources` and `/api/resources/{id}`, assign correct methods to each, and return consistent HTTP status codes (200, 201, 400, 404, 500) matching the operation outcome.

What's the best way to implement API versioning and pagination?

API versioning strategies include URL path versioning (`/api/v1/users`) or header-based approaches. Pagination uses query parameters like `?page=1&limit=10` or `?offset=0&limit=20`. Both ensure backward compatibility and allow clients to control data retrieval, filtering, and sorting through consistent query parameter patterns.

How do I structure consistent error handling and response schemas across endpoints?

Centralized error handling returns uniform response structures with HTTP status codes, error messages, and optional error codes. Define a standard schema all endpoints follow—for example, `{"status": 400, "error": "Bad Request", "message": "..."}`. This consistency simplifies client integration and debugging across your API.

Can I implement rate limiting to protect my REST API?

Rate limiting restricts request frequency per client using tokens, quotas, or time windows. Implement via middleware that tracks requests by IP, API key, or user ID and returns HTTP 429 (Too Many Requests) when limits are exceeded, protecting backend resources from overload and abuse.

What HTTP status codes should I use for different API responses?

Use 200 for successful GET/PUT, 201 for successful POST, 204 for successful DELETE with no content, 400 for client errors, 401 for authentication failures, 403 for permission denial, 404 for missing resources, and 500 for server errors. Correct status codes enable clients to handle responses appropriately.

How do I handle filtering and sorting in REST API queries?

Filtering and sorting use query parameters: `?name=John&status=active` for filtering, `?sort=created_at&order=desc` for sorting. Parse these parameters in your request handlers, apply database filters or in-memory operations, and return filtered, sorted results in a consistent response format.