Produce consistent, well-structured API designs that are easy to consume, hard to misuse, and built to evolve.
Use this decision tree:
Need flexible querying by clients (mobile/web with varying data needs)?
→ GraphQL
Need high-performance internal service-to-service communication?
→ gRPC
Need a simple, widely-understood external API?
→ REST
Need real-time bidirectional communication?
→ WebSocket (+ REST for control plane)
Need async event-driven communication between services?
→ Message queue (Kafka, SQS, RabbitMQ) — not an API pattern per seState the choice and justify it before designing anything else.
/users, not /getUsers/orders, not /order/users/{id}/orders/payment-methods, not /paymentMethods| Action | Method | Example |
|---|---|---|
| List | GET | GET /users |
| Get one | GET | GET /users/{id} |
| Create | POST | POST /users |
| Full replace | PUT | PUT /users/{id} |
| Partial update | PATCH | PATCH /users/{id} |
| Delete | DELETE | DELETE /users/{id} |
200 OK, 201 Created, 204 No Content400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 409 Conflict, 422 Unprocessable Entity500 Internal Server Error, 503 Service UnavailableAlways define with examples:
// POST /users - Request
{
"email": "user@example.com",
"name": "Jane Doe",
"role": "admin"
}
// 201 Created - Response
{
"id": "usr_abc123",
"email": "user@example.com",
"name": "Jane Doe",
"role": "admin",
"createdAt": "2024-01-15T10:30:00Z"
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Email address is invalid",
"field": "email",
"requestId": "req_xyz789"
}
}{
"data": [...],
"pagination": {
"page": 1,
"pageSize": 20,
"total": 143,
"nextCursor": "cursor_abc" // use cursor pagination for large datasets
}
}| Strategy | When to use |
|---|---|
URL versioning (/v1/users) | Public APIs, simple versioning needs — recommended default |
Header versioning (API-Version: 2024-01) | Internal APIs, clients you control |
Query param (?version=2) | Avoid — messy caching, hard to route |
Rules:
.proto files as the source of truth — version control them// comments in .proto filesBefore finalizing any API design:
achreftlili/deep-dev-skills
181fcbc
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.