agentsclimarketplace

Api design

Skill iceflower/agent-skills/api-design

Agent Skills 오픈 표준 기반 AI 코딩 에이전트용 스킬 컬렉션 (Java, Kotlin, Spring, NestJS, K8s, Terraform, GraphQL, gRPC, OpenTelemetry, a11y, i18n 등 60개)

Install
npx -y skills add iceflower/agent-skills --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

  • 0 stars0 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

REST API design principles including URL design, HTTP methods, status codes, pagination, versioning, security, and OpenAPI documentation. Use when designing or implementing REST APIs.

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

7.1 KB, as published. Nobody here has run it

REST API Design Rules

1. URL Design

Basic Principles

  • Use nouns, not verbs, to represent resources
  • Use plural forms instead of singular
  • Use kebab-case for URL paths (lowercase with hyphens)
  • Represent hierarchical relationships in the URL structure

URL Patterns

# Resource collection
GET    /users                  # List users
POST   /users                  # Create user

# Specific resource
GET    /users/{id}             # Get specific user
PUT    /users/{id}             # Full update
PATCH  /users/{id}             # Partial update
DELETE /users/{id}             # Delete user

# Sub-resources
GET    /users/{id}/orders      # List user's orders
POST   /users/{id}/orders      # Create order for user
GET    /users/{id}/orders/{orderId}  # Get specific order

# Actions (when noun representation is difficult)
POST   /users/{id}/password-reset   # Reset password
POST   /orders/{id}/cancel          # Cancel order

Anti-Patterns

# Bad examples
GET    /getUsers
POST   /createUser
DELETE /deleteUser/123
GET    /user              # singular form
GET    /Users             # uppercase
GET    /user_orders       # snake_case

# Good examples
GET    /users
POST   /users
DELETE /users/123

2. HTTP Methods

Method Usage

MethodPurposeIdempotentSafeRequest Body
GETRetrieveYesYesNo
POSTCreateNoNoYes
PUTFull UpdateYesNoYes
PATCHPartial UpdateNoNoYes
DELETERemoveYesNoNo

Idempotency

  • Idempotent: Multiple identical requests produce the same result
  • GET, PUT, DELETE must guarantee idempotency
  • POST is not idempotent → duplicate creation prevention logic required

3. HTTP Status Codes

Success (2xx)

CodeMeaningUse Case
200OKGeneral success
201CreatedResource created successfully
202AcceptedAsync processing started
204No ContentSuccess with no response body

Redirection (3xx)

CodeMeaningUse Case
301Moved PermanentlyResource permanently moved
302FoundTemporary redirect
304Not ModifiedCached resource unchanged

Client Errors (4xx)

CodeMeaningUse Case
400Bad RequestInvalid request format
401UnauthorizedAuthentication required
403ForbiddenNo permission
404Not FoundResource not found
409ConflictResource conflict
422Unprocessable EntityValidation failed
429Too Many RequestsRate limit exceeded

Server Errors (5xx)

CodeMeaningUse Case
500Internal Server ErrorServer internal error
502Bad GatewayUpstream server error
503Service UnavailableService temporarily down
504Gateway TimeoutUpstream server timeout

4. Request/Response Format

Request Headers

Content-Type: application/json
Accept: application/json
Authorization: Bearer <token>
X-Request-ID: <uuid>

Response Format - Success

{
  "data": {
    "id": "user-001",
    "email": "[email protected]",
    "name": "John Doe"
  },
  "meta": {
    "timestamp": "2024-01-15T10:30:45.123Z",
    "requestId": "abc-123"
  }
}

Response Format - List

{
  "data": [
    { "id": "user-001", "name": "John Doe" },
    { "id": "user-002", "name": "Jane Doe" }
  ],
  "meta": {
    "total": 100,
    "page": 1,
    "perPage": 20,
    "totalPages": 5
  }
}

Response Format - Error

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid input data",
    "details": [
      {
        "field": "email",
        "message": "Invalid email format"
      }
    ]
  },
  "meta": {
    "timestamp": "2024-01-15T10:30:45.123Z",
    "requestId": "abc-123"
  }
}

5. Pagination

Pagination Strategy Selection

MethodProsConsBest For
OffsetSimple, easy page navSlow on large datasetsSmall datasets
CursorFast, consistentNo page navigationLarge datasets
KeysetFastFixed sort keyFixed sort order

6. Filtering, Sorting, Field Selection

# Filtering
GET /users?status=active&role=admin

# Sorting
GET /users?sort=-createdAt         # descending
GET /users?sort=name,-createdAt    # multiple sort

# Field Selection
GET /users?fields=id,name,email

7. API Versioning

See references/versioning.md for detailed patterns including:

  • Version identification strategies (URL, Header, Custom)
  • Compatibility principles (safe vs breaking changes)
  • Handling breaking changes and deprecation

8. Security

  • All APIs must be served over HTTPS only
  • Never include sensitive data in URLs — use request body
  • Implement rate limiting with X-RateLimit-* headers

9. Documentation

See references/documentation.md for detailed patterns including:

  • OpenAPI specification structure
  • Schema and parameter documentation
  • Error response documentation
  • Authentication documentation

10. References

Related Skills

  • For OpenAPI specification writing and schema design, see openapi-spec skill

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.