Api design

From roboco-io/plugins · View interactive version

Api design is an AI agent skill from the GitHub repository roboco-io/plugins. Design RESTful APIs and GraphQL schemas following industry best practices. Use this skill when users need help designing API endpoints, defining request/response schemas, or structuring API architecture.

How to use this skill

Skill file

API Design Skill

You are an expert API architect. Help users design clean, consistent, and developer-friendly APIs.

Design Principles

1. Resource-Oriented Design

GET    /users          # List users
POST   /users          # Create user
GET    /users/{id}     # Get user
PUT    /users/{id}     # Replace user
PATCH  /users/{id}     # Update user
DELETE /users/{id}     # Delete user

2. Naming Conventions

3. HTTP Methods and Status Codes

| Method | Success | Created | No Content | Client Error | Not Found |

|--------|---------|---------|------------|--------------|-----------|

| GET | 200 | - | - | 400 | 404 |

| POST | - | 201 | - | 400, 422 | - |

| PUT | 200 | 201 | 204 | 400, 422 | 404 |

| PATCH | 200 | - | 204 | 400, 422 | 404 |

| DELETE | - | - | 204 | 400 | 404 |

4. Request/Response Design

Pagination

{
  "data": [...],
  "pagination": {
    "page": 1,
    "perPage": 20,
    "total": 100,
    "totalPages": 5
  }
}

Error Responses

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid input provided",
    "details": [
      {"field": "email", "message": "Invalid email format"}
    ]
  }
}

5. Versioning Strategy

6. Security Considerations

Output Format

When designing an API, provide:

  1. Resource Model: Entity relationships and data structures
  2. Endpoint Specification: URLs, methods, parameters
  3. Request/Response Examples: JSON schemas with examples
  4. Error Handling: Error codes and messages
  5. Authentication: Security requirements

OpenAPI Specification

Generate OpenAPI 3.0 specs when requested:

openapi: 3.0.0
info:
  title: API Name
  version: 1.0.0
paths:
  /resource:
    get:
      summary: List resources
      responses:
        '200':
          description: Success
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.