api-best-practices

Design and document RESTful APIs with HTTP methods, status codes, and authentication.

7|Updated Oct 12, 2025
One-click install
npx skills add https://github.com/webdevtodayjason/titanium-plugins --skill api-best-practices
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-best-practices
Source: https://github.com/webdevtodayjason/titanium-plugins/tree/main/plugins/titanium-toolkit/skills/api-best-practices
Command: npx skills add https://github.com/webdevtodayjason/titanium-plugins --skill api-best-practices

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires jwt, oauth2, axios, pydantic, express, cors, helmet, k6.

What problem does it solve?

This Skill helps you avoid common pitfalls in API design, ensuring you build intuitive, secure, and high-performing RESTful services that developers love to use.

Core Features & Use Cases

  • RESTful Design & Versioning: Guides on resource-oriented design, HTTP methods, status codes, and URL/header versioning strategies.
  • Security & Error Handling: Covers JWT, OAuth, API keys, input validation, CORS, rate limiting, and standardized error responses.
  • OpenAPI Documentation: Provides patterns for creating comprehensive API specifications using OpenAPI/Swagger.
  • Use Case: When designing a new microservice, use this Skill to define its API endpoints, authentication mechanisms, error handling, and versioning strategy, ensuring it's robust and future-proof from day one.

Quick Start

"I'm designing a new REST API for user management. Guide me through the best practices for defining endpoints, choosing HTTP methods, and handling authentication using JWT."

Frequently Asked Questions about api-best-practices

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

FAQPage Schema
How do I design a secure REST API with authentication?

Design secure REST APIs by implementing authentication mechanisms like JWT or OAuth2, validating all inputs, enabling CORS selectively, applying rate limiting, and using HTTPS. Combine these with proper error handling and standardized response formats to prevent common vulnerabilities.

What's the best way to version and document APIs?

Version APIs using URL or header strategies, then document them comprehensively with OpenAPI/Swagger specifications. This approach enables developers to understand endpoints, parameters, authentication requirements, and response structures clearly before integration.

How do I handle errors and status codes in REST APIs?

REST APIs should return appropriate HTTP status codes (200, 400, 401, 403, 404, 500) paired with standardized error response formats. Include error codes, messages, and contextual details to help developers debug issues quickly and handle failures gracefully.

Can I use JWT and OAuth2 together in API design?

Yes, JWT tokens are often issued by OAuth2 authorization servers. OAuth2 handles the authorization flow and token issuance, while JWT serves as the token format for stateless API authentication, combining security with scalability.

What security measures should I implement for API endpoints?

Secure API endpoints with CORS policies, rate limiting, input validation, API keys, JWT/OAuth2 authentication, and helmet headers to prevent injection attacks, unauthorized access, and abuse. Combine these layers for defense-in-depth protection.

How do I structure resource-oriented endpoints in REST?

Structure endpoints around nouns (resources) rather than verbs: use /users, /posts, /comments as base URLs. Apply HTTP methods (GET, POST, PUT, DELETE) to express actions, maintain consistent naming conventions, and implement proper status codes for each operation.