home / skills / tlabs-xyz / tbtc-v2-performance / backend-api-endpoints

backend-api-endpoints skill

/.claude/skills/backend-api-endpoints

This skill helps you design and implement RESTful API endpoints, ensuring consistent routes, methods, and versioning across frameworks.

npx playbooks add skill tlabs-xyz/tbtc-v2-performance --skill backend-api-endpoints

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
2.1 KB
---
name: Backend API Endpoints
description: Design and implement RESTful API endpoints following REST principles, resource-based URL conventions, and HTTP method best practices. Use this skill when creating new API endpoints, defining routes or controllers, implementing REST resources, updating endpoint URL structures, working with HTTP method handlers (GET, POST, PUT, PATCH, DELETE), implementing API versioning, designing nested resource endpoints, adding query parameter support for filtering/sorting/pagination, setting up route middleware, implementing rate limiting headers, working with API routing configuration files, creating or updating API documentation, or refactoring endpoint structure for consistency. Use when working with Express.js routes, NestJS controllers, FastAPI endpoints, Django views, Rails controllers, or any backend framework's routing mechanisms.
---

## When to use this skill

- When creating new API endpoints or REST resources
- When defining or updating route handlers and controller methods
- When implementing HTTP method handlers (GET, POST, PUT, PATCH, DELETE)
- When designing URL structure for API resources
- When implementing or updating API versioning strategies
- When working with nested resource endpoints
- When adding query parameter support for filtering, sorting, or pagination
- When setting up route middleware or request handlers
- When implementing rate limiting or throttling for endpoints
- When working with routing configuration files (routes.js, urls.py, etc.)
- When refactoring endpoint structure for consistency
- When creating or updating API documentation
- When working with Express.js routes, NestJS controllers, FastAPI endpoints, Django views, Rails controllers, or similar framework routing

# Backend API Endpoints

This Skill provides Claude Code with specific guidance on how to adhere to coding standards as they relate to how it should handle backend API endpoints.

## Instructions

For details, refer to the information provided in this file:
[backend API endpoints](../../../agent-os/standards/backend/api/endpoints.md)

Overview

This skill helps design and implement RESTful API endpoints following resource-based URL conventions, HTTP method best practices, and versioning patterns. It guides route structure, controller responsibilities, parameter handling, and middleware placement to produce consistent, maintainable APIs. Use it to create, refactor, or document endpoints across common backend frameworks.

How this skill works

The skill inspects desired resources and maps them to clear, predictable routes, choosing HTTP verbs that reflect intent (GET for read, POST for create, PUT/PATCH for update, DELETE for remove). It defines nested resource patterns, query parameter formats for filtering/sorting/pagination, and versioned route prefixes. It also recommends where to attach middleware, rate-limiting headers, and validation logic, and produces examples for Express, NestJS, FastAPI, Django, or Rails patterns.

When to use it

  • Creating new REST endpoints or resources from a product spec
  • Defining route handlers, controller methods, or view functions
  • Implementing or updating HTTP method handling and status codes
  • Designing nested resources, query params, and pagination
  • Adding API versioning or refactoring URL structures for consistency
  • Configuring route middleware, rate limiting, or routing files

Best practices

  • Model routes around resources: /v1/users and /v1/users/:id rather than RPC verbs
  • Use appropriate HTTP methods and idempotency (PUT for full replace, PATCH for partial updates)
  • Keep controllers thin: validate and authorize in middleware, business logic in services
  • Support filtering, sorting, pagination via query params (avoid body for GET)
  • Version URLs or headers consistently to avoid breaking clients
  • Return meaningful status codes and consistent error payloads

Example use cases

  • Designing a /v1/projects/:projectId/tasks nested endpoint with GET/POST and query filters
  • Refactoring inconsistent endpoints to /v2/resources/:id and adding backward-compatible headers
  • Implementing pagination and sorting for a list endpoint with limit/offset or cursor support
  • Attaching authentication and rate-limit middleware to sensitive routes in Express
  • Generating concise API documentation examples for controllers in TypeScript/NestJS

FAQ

Should I use PUT or PATCH for updates?

Use PUT for full resource replacement when the client sends the complete resource; use PATCH for partial updates to avoid accidentally removing fields.

Where should validation and auth live?

Handle validation and authentication in middleware or decorators so controllers remain focused on orchestration and services handle business rules.