agentsclimarketplace

Api design

Skill fabioc-aloha/Alex_Skill_Mall/plugins/architecture-patterns/api-design

284 curated plugins for AI assistants across 16 categories: security, Azure, documentation, code quality, cloud infrastructure, and more. Works with GitHub Copilot. Drop into .github/skills/local/ and go.

Install
npx -y skills add fabioc-aloha/Alex_Skill_Mall --skill api-design

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Design APIs that developers love to use.

SKILL.md

5.3 KB, as published. Nobody here has run it

API Design Skill

Design APIs that developers love to use.

Core Principle

A good API is intuitive, consistent, and hard to misuse. Design for the consumer, not the implementation.

REST Fundamentals

Resource Naming

GoodBadWhy
/users/getUsersNouns, not verbs
/users/123/user?id=123Path params for identity
/users/123/orders/getUserOrdersHierarchical resources
/search?q=term/search/termQuery params for filters

HTTP Methods

MethodPurposeIdempotentSafe
GETRead resourceYesYes
POSTCreate resourceNoNo
PUTReplace resourceYesNo
PATCHPartial updateNo*No
DELETERemove resourceYesNo

Status Codes

CodeMeaningWhen to Use
200OKSuccessful GET, PUT, PATCH
201CreatedSuccessful POST
204No ContentSuccessful DELETE
400Bad RequestValidation error
401UnauthorizedMissing authentication
403ForbiddenAuthenticated but not allowed
404Not FoundResource doesn't exist
409ConflictState conflict (duplicate)
429Too Many RequestsRate limited
500Internal ErrorServer bug

Contract-First Design

  1. Define the contract (OpenAPI/Swagger)
  2. Review with consumers before coding
  3. Generate server stubs from contract
  4. Implement business logic
  5. Validate responses against contract
openapi: 3.1.0  # 3.1.0 aligns with JSON Schema 2020-12
info:
  title: My API
  version: 1.0.0
paths:
  /users:
    get:
      summary: List users
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserList'

Versioning

StrategyExampleRecommendation
URL Path/v1/usersPreferred - explicit
HeaderAccept: vnd.api.v1+jsonClean but hidden
Query/users?version=1Avoid

Pagination Patterns

Offset-Based

GET /users?offset=40&limit=20
{ "data": [...], "pagination": { "total": 150 } }

Cursor-Based (Preferred for large datasets)

GET /users?cursor=abc123&limit=20
{ "data": [...], "next_cursor": "def456" }

Error Response Design

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request parameters",
    "details": [{ "field": "email", "message": "Invalid format" }],
    "request_id": "req_abc123"
  }
}

Principles:

  • Machine-readable code
  • Human-readable message
  • Request ID for correlation
  • Never expose stack traces

Caching

HTTP Cache Headers

HeaderPurpose
Cache-ControlCaching directives
ETagContent fingerprint
VaryCache key factors
Cache-Control: public, max-age=3600
Cache-Control: private, max-age=300
Cache-Control: no-store

ETag Flow

GET /users/123
-> 200 OK, ETag: "v1-abc123"

GET /users/123, If-None-Match: "v1-abc123"
-> 304 Not Modified (or 200 with new ETag)

Rate Limiting

Algorithms

AlgorithmDescription
Fixed WindowX requests per minute
Token BucketBurst-friendly with refill
Sliding WindowRolling time window

Response Headers

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1706792400

# When exceeded
429 Too Many Requests
Retry-After: 30

Rate Limit Tiers

TierLimitUse Case
Anonymous60/hourPublic exploration
Authenticated1000/hourNormal usage
Premium10000/hourPower users

Request/Response Design

  • Use camelCase or snake_case consistently
  • Timestamps in ISO 8601: 2026-02-01T14:30:00Z
  • IDs as strings (future-proof for UUIDs)
  • Envelope responses: { "data": ..., "meta": ... }

Partial Responses

GET /users/123?fields=id,name,email

Security Checklist

  • Authentication on all non-public endpoints
  • Authorization checked for each resource
  • Rate limiting enabled
  • Input validation (size limits, type checking)
  • No sensitive data in URLs
  • CORS configured appropriately
  • Audit logging for sensitive operations

Documentation Requirements

  • Authentication: How to get and use tokens
  • Quick Start: Working example in < 5 minutes
  • Reference: Every endpoint, parameter, response
  • Errors: All error codes and recovery steps
  • Changelog: What changed in each version

API Review Checklist

  • Resource names are nouns, plural
  • HTTP methods match semantics
  • Status codes are appropriate
  • Error responses are consistent
  • Pagination for lists
  • Versioning strategy clear
  • Rate limits defined
  • OpenAPI spec accurate

Anti-Patterns

  • Verbs in URLs (/getUser)
  • Exposing internal IDs (auto-increment)
  • Inconsistent naming conventions
  • No versioning strategy
  • Missing rate limits
  • Exposing stack traces in errors
  • Breaking changes without version bump

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.