Don Cheli: API Contract Designer
Instructions
- Identify the API style: REST, GraphQL, gRPC, Webhook, or mixed
- For each resource/operation, define:
- Method + path (REST) or operation name (GraphQL/gRPC)
- Request schema: headers, path params, query params, body
- Response schemas: success + all error cases
- Design cross-cutting concerns:
- Auth: mechanism (JWT, OAuth2, API Key, mTLS), scopes, token lifetime
- Rate limiting: strategy (token bucket / leaky bucket), limits per tier, headers exposed
- Error handling: standard error envelope, HTTP status mapping, error codes catalog
- Retries: which operations are safe to retry, backoff strategy, max attempts
- Circuit breaker: thresholds, half-open probe, fallback behavior
- Idempotency: which operations require idempotency keys, TTL, conflict semantics
- Define versioning strategy (URL path, header, or content negotiation)
- Flag breaking vs. non-breaking changes policy
Output Format
## API Contract: <service/feature name>
### Style & Version
- Protocol: REST / GraphQL / gRPC / Webhook
- Base URL: …
- Version: v1 (strategy: <path/header/content-negotiation>)
### Endpoints / Operations
#### <METHOD> <path>
**Purpose:** …
**Auth required:** yes/no — scope: …
**Request:**
```json
{
"field": "type — description"
}
Response 200:
{ … }
Error responses:
| Status |
Code |
Meaning |
| 400 |
INVALID_INPUT |
… |
| 409 |
CONFLICT |
… |
Idempotency: required / not required — key:
Cross-Cutting Concerns
Auth: …
Rate Limiting: X req/min per API key; headers: X-RateLimit-Remaining, X-RateLimit-Reset
Retry Policy: safe methods (GET, PUT, DELETE) — exponential backoff, max 3 attempts
Circuit Breaker: open at 50% error rate over 10s window; half-open probe after 30s
Error Envelope:
{ "error": { "code": "…", "message": "…", "trace_id": "…" } }
Breaking Change Policy
- Breaking: removing fields, changing types, removing endpoints → requires major version bump
- Non-breaking: adding optional fields, new endpoints → compatible within same version
## Quality Gate
- Every endpoint must have at least one documented error response
- Idempotency policy must be explicit (required or not required) for every mutating operation
- Auth scopes must be listed for every endpoint that requires authentication
- Rate limit headers must be named consistently across all endpoints
## Do not use this skill when
- The API already exists and the user wants to review it (use doncheli-review instead)
- The user only wants implementation, not contract design (use doncheli-implement instead)
1---
2name: doncheli-api-contract
3description: Design complete API contracts covering endpoints, auth, rate limiting, error handling, retries, circuit breaker and idempotency. Activate when user mentions "api contract", "api design", "endpoint", "webhook", "REST", "GraphQL", "OpenAPI", "design the API".
4metadata:
5 source: https://skillmd.com/skills/aibot88/doncheli-api-contract
6---
7
8# Don Cheli: API Contract Designer
9
10## Instructions
11
121. Identify the API style: REST, GraphQL, gRPC, Webhook, or mixed
132. For each resource/operation, define:
14 - Method + path (REST) or operation name (GraphQL/gRPC)
15 - Request schema: headers, path params, query params, body
16 - Response schemas: success + all error cases
173. Design cross-cutting concerns:
18 - **Auth**: mechanism (JWT, OAuth2, API Key, mTLS), scopes, token lifetime
19 - **Rate limiting**: strategy (token bucket / leaky bucket), limits per tier, headers exposed
20 - **Error handling**: standard error envelope, HTTP status mapping, error codes catalog
21 - **Retries**: which operations are safe to retry, backoff strategy, max attempts
22 - **Circuit breaker**: thresholds, half-open probe, fallback behavior
23 - **Idempotency**: which operations require idempotency keys, TTL, conflict semantics
244. Define versioning strategy (URL path, header, or content negotiation)
255. Flag breaking vs. non-breaking changes policy
26
27## Output Format
28
29```
30## API Contract: <service/feature name>
31
32### Style & Version
33- Protocol: REST / GraphQL / gRPC / Webhook
34- Base URL: …
35- Version: v1 (strategy: <path/header/content-negotiation>)
36
37### Endpoints / Operations
38
39#### <METHOD> <path>
40**Purpose:** …
41**Auth required:** yes/no — scope: …
42**Request:**
43```json
44{
45 "field": "type — description"
46}
47```
48**Response 200:**
49```json
50{ … }
51```
52**Error responses:**
53| Status | Code | Meaning |
54|--------|---------------|----------------------|
55| 400 | INVALID_INPUT | … |
56| 409 | CONFLICT | … |
57
58**Idempotency:** required / not required — key: <header name>
59
60---
61
62### Cross-Cutting Concerns
63
64**Auth:** …
65**Rate Limiting:** X req/min per API key; headers: X-RateLimit-Remaining, X-RateLimit-Reset
66**Retry Policy:** safe methods (GET, PUT, DELETE) — exponential backoff, max 3 attempts
67**Circuit Breaker:** open at 50% error rate over 10s window; half-open probe after 30s
68**Error Envelope:**
69```json
70{ "error": { "code": "…", "message": "…", "trace_id": "…" } }
71```
72
73### Breaking Change Policy
74- Breaking: removing fields, changing types, removing endpoints → requires major version bump
75- Non-breaking: adding optional fields, new endpoints → compatible within same version
76```
77
78## Quality Gate
79
80- Every endpoint must have at least one documented error response
81- Idempotency policy must be explicit (required or not required) for every mutating operation
82- Auth scopes must be listed for every endpoint that requires authentication
83- Rate limit headers must be named consistently across all endpoints
84
85## Do not use this skill when
86
87- The API already exists and the user wants to review it (use doncheli-review instead)
88- The user only wants implementation, not contract design (use doncheli-implement instead)