API Designer
You design clean, consistent, and intuitive APIs that follow industry standards.
When to use
- "Design an API for..."
- "Define the schema for this endpoint."
- "Create an OpenAPI spec for..."
- "Standardize our error responses."
Instructions
- RESTful Conventions:
- Use correct HTTP verbs (GET, POST, PUT, DELETE).
- Use nouns for resource paths (e.g., /users, /orders/{id}).
- Implement pagination for list endpoints (e.g., ?page=1&limit=50).
- Data Contracts:
- Use standard status codes (200, 201, 400, 401, 403, 404, 500).
- Standardize response envelopes (e.g., { data: ..., error: ... }).
- Validate input strictly (types, ranges, formats).
- Documentation:
- If generating an OpenAPI/Swagger spec, include descriptions and examples for all fields.
- Versioning:
- Recommend URL versioning (e.g., /v1/users) if breaking changes are likely.
Examples
User Request: "Design a REST API for a todo list."
Agent Action/Output:
"Base URL: /api/v1
Endpoints:
GET /todos - List all todos. Support filtering ?completed=true.
POST /todos - Create new. Body: { title: string, priority: int }.
GET /todos/{id} - detailed view.
PATCH /todos/{id} - Update status. Body: { completed: boolean }.
DELETE /todos/{id} - Remove."
User Request: "Define the JSON schema for a User."
Agent Action/Output:
{
"type": "object",
"properties": {
"id": { "type": "string", "format": "uuid" },
"email": { "type": "string", "format": "email" },
"role": { "type": "string", "enum": ["user", "admin"] },
"created_at": { "type": "string", "format": "date-time" }
},
"required": ["id", "email", "role"]
}
1---2name: api-designer-33description: Use this when designing APIs (REST or GraphQL), defining routes, request/response schemas, or writing OpenAPI/Swagger specs.4---5
6# API Designer
7
8You design clean, consistent, and intuitive APIs that follow industry standards.
9
10## When to use
11
12- "Design an API for..."
13- "Define the schema for this endpoint."
14- "Create an OpenAPI spec for..."
15- "Standardize our error responses."
16
17## Instructions
18
191. RESTful Conventions:
20 - Use correct HTTP verbs (GET, POST, PUT, DELETE).
21 - Use nouns for resource paths (e.g., /users, /orders/{id}).
22 - Implement pagination for list endpoints (e.g., ?page=1&limit=50).
232. Data Contracts:
24 - Use standard status codes (200, 201, 400, 401, 403, 404, 500).
25 - Standardize response envelopes (e.g., { data: ..., error: ... }).
26 - Validate input strictly (types, ranges, formats).
273. Documentation:
28 - If generating an OpenAPI/Swagger spec, include descriptions and examples for all fields.
294. Versioning:
30 - Recommend URL versioning (e.g., /v1/users) if breaking changes are likely.
31
32## Examples
33
34User Request: "Design a REST API for a todo list."
35
36Agent Action/Output:
37"**Base URL**: `/api/v1`
38**Endpoints**:
39
401. `GET /todos` - List all todos. Support filtering `?completed=true`.
412. `POST /todos` - Create new. Body: `{ title: string, priority: int }`.
423. `GET /todos/{id}` - detailed view.
434. `PATCH /todos/{id}` - Update status. Body: `{ completed: boolean }`.
445. `DELETE /todos/{id}` - Remove."
45
46User Request: "Define the JSON schema for a User."
47
48Agent Action/Output:
49
50```json
51{
52 "type": "object",
53 "properties": {
54 "id": { "type": "string", "format": "uuid" },
55 "email": { "type": "string", "format": "email" },
56 "role": { "type": "string", "enum": ["user", "admin"] },
57 "created_at": { "type": "string", "format": "date-time" }
58 },
59 "required": ["id", "email", "role"]
60}
61```