locus-product-planning 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +2 -2
- package/README.md +11 -7
- package/package.json +1 -1
- package/skills/04-developer-specializations/core/api-designer/SKILL.md +579 -0
- package/skills/04-developer-specializations/design/ui-ux-designer/SKILL.md +337 -0
- package/skills/04-developer-specializations/infrastructure/database-architect/SKILL.md +430 -0
- package/skills/04-developer-specializations/quality/test-automation-engineer/SKILL.md +711 -0
- package/skills/05-specialists/technical-writer/SKILL.md +576 -0
- package/skills/using-locus/SKILL.md +5 -3
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
"name": "locus",
|
|
4
4
|
"display_name": "Locus - Project Planning",
|
|
5
5
|
"description": "Your center point for planning and building projects with AI. Go from idea to implementation through 4 simple steps: Vision -> Features -> Design -> Build.",
|
|
6
|
-
"long_description": "Locus provides a comprehensive skills framework for AI-powered project planning. It includes:\n\n-
|
|
7
|
-
"version": "1.
|
|
6
|
+
"long_description": "Locus provides a comprehensive skills framework for AI-powered project planning. It includes:\n\n- 46 specialized skills covering executive strategy, product management, engineering leadership, and developer specializations\n- 14 agent definitions for specialized perspectives\n- Automatic skill loading and discovery\n- Simple 4-step project planning workflow\n\nPerfect for:\n- Starting new projects from scratch\n- Getting diverse perspectives on technical decisions\n- Following proven development workflows\n- Organizing complex multi-step implementations",
|
|
7
|
+
"version": "1.2.0",
|
|
8
8
|
"author": "swiggityswerve",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": "https://github.com/SwiggitySwerve/locus-product-planning",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://claude.ai/plugin.json",
|
|
3
3
|
"name": "locus",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"description": "AI-powered project planning with
|
|
4
|
+
"version": "1.2.0",
|
|
5
|
+
"description": "AI-powered project planning with 46 skills: Vision -> Features -> Design -> Build",
|
|
6
6
|
"author": "swiggityswerve",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"homepage": "https://github.com/SwiggitySwerve/locus-product-planning",
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**Your center point for planning and building products with AI.**
|
|
4
4
|
|
|
5
|
-
Locus guides you from idea to implementation through a simple 4-step process, backed by
|
|
5
|
+
Locus guides you from idea to implementation through a simple 4-step process, backed by 46 specialized skills and 14 agent definitions.
|
|
6
6
|
|
|
7
7
|
## Quick Start
|
|
8
8
|
|
|
@@ -85,7 +85,7 @@ Or just describe what you want: "I want to build..."
|
|
|
85
85
|
| `find_skills` | List skills with optional category/tier/search filters |
|
|
86
86
|
| `find_agents` | List available agent definitions |
|
|
87
87
|
|
|
88
|
-
## Skills Library (
|
|
88
|
+
## Skills Library (46)
|
|
89
89
|
|
|
90
90
|
### Executive Suite
|
|
91
91
|
Strategic leadership perspectives:
|
|
@@ -115,18 +115,21 @@ Technical leadership and architecture:
|
|
|
115
115
|
### Developer Specializations
|
|
116
116
|
Domain expertise organized by category:
|
|
117
117
|
|
|
118
|
-
**Core**: `frontend-developer`, `backend-developer`, `fullstack-developer`, `mobile-developer`
|
|
118
|
+
**Core**: `frontend-developer`, `backend-developer`, `fullstack-developer`, `mobile-developer`, `api-designer`
|
|
119
119
|
|
|
120
120
|
**Languages**: `typescript-pro`, `python-pro`, `rust-engineer`, `golang-pro`, `java-architect`
|
|
121
121
|
|
|
122
|
-
**Infrastructure**: `devops-engineer`, `cloud-architect`, `kubernetes-specialist`, `platform-engineer`, `security-engineer`, `sre-engineer`
|
|
122
|
+
**Infrastructure**: `devops-engineer`, `cloud-architect`, `kubernetes-specialist`, `platform-engineer`, `security-engineer`, `sre-engineer`, `database-architect`
|
|
123
123
|
|
|
124
124
|
**Data & AI**: `data-engineer`, `data-scientist`, `ml-engineer`, `llm-architect`
|
|
125
125
|
|
|
126
|
-
**Quality**: `qa-expert`, `performance-engineer`, `security-auditor`, `accessibility-tester`
|
|
126
|
+
**Quality**: `qa-expert`, `performance-engineer`, `security-auditor`, `accessibility-tester`, `test-automation-engineer`
|
|
127
|
+
|
|
128
|
+
**Design**: `ui-ux-designer`
|
|
127
129
|
|
|
128
130
|
### Specialists
|
|
129
131
|
- `locus:compliance-specialist` - Regulatory compliance
|
|
132
|
+
- `locus:technical-writer` - Documentation and technical writing
|
|
130
133
|
|
|
131
134
|
## Agents (14)
|
|
132
135
|
|
|
@@ -141,13 +144,14 @@ Pre-configured agent definitions for specialized perspectives:
|
|
|
141
144
|
## Project Structure
|
|
142
145
|
|
|
143
146
|
```
|
|
144
|
-
skills/ #
|
|
147
|
+
skills/ # 46 skill definitions
|
|
145
148
|
├── using-locus/ # Main bootstrap skill
|
|
146
149
|
├── 01-executive-suite/ # C-suite perspectives
|
|
147
150
|
├── 02-product-management/
|
|
148
151
|
├── 03-engineering-leadership/
|
|
149
152
|
├── 04-developer-specializations/
|
|
150
153
|
│ ├── core/
|
|
154
|
+
│ ├── design/
|
|
151
155
|
│ ├── languages/
|
|
152
156
|
│ ├── infrastructure/
|
|
153
157
|
│ ├── data-ai/
|
|
@@ -175,7 +179,7 @@ opencode.json # OpenCode commands
|
|
|
175
179
|
git clone https://github.com/SwiggitySwerve/locus-product-planning.git
|
|
176
180
|
cd locus-product-planning
|
|
177
181
|
npm install
|
|
178
|
-
npm test #
|
|
182
|
+
npm test # 184 tests
|
|
179
183
|
npm run build # Compile TypeScript
|
|
180
184
|
```
|
|
181
185
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,579 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api-designer
|
|
3
|
+
description: REST and GraphQL API design, versioning strategies, documentation, and building developer-friendly interfaces
|
|
4
|
+
metadata:
|
|
5
|
+
version: "1.0.0"
|
|
6
|
+
tier: developer-specialization
|
|
7
|
+
category: core
|
|
8
|
+
council: code-review-council
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# API Designer
|
|
12
|
+
|
|
13
|
+
You embody the perspective of a senior API designer with expertise in creating intuitive, well-documented, and developer-friendly APIs that stand the test of time.
|
|
14
|
+
|
|
15
|
+
## When to Apply
|
|
16
|
+
|
|
17
|
+
Invoke this skill when:
|
|
18
|
+
- Designing new APIs (REST, GraphQL, gRPC)
|
|
19
|
+
- Reviewing API designs for consistency
|
|
20
|
+
- Planning API versioning strategies
|
|
21
|
+
- Writing API documentation
|
|
22
|
+
- Designing error handling and response formats
|
|
23
|
+
- Creating API security patterns
|
|
24
|
+
- Building SDK-friendly interfaces
|
|
25
|
+
- Planning backwards-compatible changes
|
|
26
|
+
|
|
27
|
+
## Core Competencies
|
|
28
|
+
|
|
29
|
+
### 1. API Design
|
|
30
|
+
- Resource modeling and naming
|
|
31
|
+
- HTTP method semantics
|
|
32
|
+
- Response format consistency
|
|
33
|
+
- Error handling patterns
|
|
34
|
+
|
|
35
|
+
### 2. Documentation
|
|
36
|
+
- OpenAPI/Swagger specifications
|
|
37
|
+
- Interactive documentation
|
|
38
|
+
- Code examples and SDKs
|
|
39
|
+
- Changelog management
|
|
40
|
+
|
|
41
|
+
### 3. Versioning
|
|
42
|
+
- Breaking vs non-breaking changes
|
|
43
|
+
- Deprecation strategies
|
|
44
|
+
- Migration support
|
|
45
|
+
- Multiple version maintenance
|
|
46
|
+
|
|
47
|
+
### 4. Security
|
|
48
|
+
- Authentication patterns
|
|
49
|
+
- Authorization design
|
|
50
|
+
- Rate limiting
|
|
51
|
+
- Input validation
|
|
52
|
+
|
|
53
|
+
## REST API Design
|
|
54
|
+
|
|
55
|
+
### Resource Naming Conventions
|
|
56
|
+
|
|
57
|
+
| Pattern | Example | Description |
|
|
58
|
+
|---------|---------|-------------|
|
|
59
|
+
| **Collection** | `/users` | List of resources |
|
|
60
|
+
| **Instance** | `/users/123` | Single resource |
|
|
61
|
+
| **Sub-resource** | `/users/123/orders` | Related collection |
|
|
62
|
+
| **Action** | `/users/123/activate` | Non-CRUD operation |
|
|
63
|
+
|
|
64
|
+
### Naming Rules
|
|
65
|
+
- Use nouns, not verbs (except actions)
|
|
66
|
+
- Use plural for collections
|
|
67
|
+
- Use kebab-case for multi-word
|
|
68
|
+
- Avoid deep nesting (max 2-3 levels)
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
Good:
|
|
72
|
+
GET /users
|
|
73
|
+
GET /users/123
|
|
74
|
+
GET /users/123/orders
|
|
75
|
+
POST /users/123/reset-password
|
|
76
|
+
|
|
77
|
+
Bad:
|
|
78
|
+
GET /getUsers
|
|
79
|
+
GET /user/123 (inconsistent plural)
|
|
80
|
+
GET /users/123/orders/456/items/789/details (too deep)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### HTTP Methods
|
|
84
|
+
|
|
85
|
+
| Method | Use | Idempotent | Safe |
|
|
86
|
+
|--------|-----|------------|------|
|
|
87
|
+
| **GET** | Read resource(s) | Yes | Yes |
|
|
88
|
+
| **POST** | Create resource | No | No |
|
|
89
|
+
| **PUT** | Replace resource | Yes | No |
|
|
90
|
+
| **PATCH** | Partial update | No* | No |
|
|
91
|
+
| **DELETE** | Remove resource | Yes | No |
|
|
92
|
+
|
|
93
|
+
*PATCH can be idempotent with proper design
|
|
94
|
+
|
|
95
|
+
### Status Codes
|
|
96
|
+
|
|
97
|
+
| Range | Meaning | Common Codes |
|
|
98
|
+
|-------|---------|--------------|
|
|
99
|
+
| **2xx** | Success | 200 OK, 201 Created, 204 No Content |
|
|
100
|
+
| **3xx** | Redirect | 301 Moved, 304 Not Modified |
|
|
101
|
+
| **4xx** | Client error | 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 409 Conflict, 422 Unprocessable |
|
|
102
|
+
| **5xx** | Server error | 500 Internal Error, 502 Bad Gateway, 503 Unavailable |
|
|
103
|
+
|
|
104
|
+
### Status Code Decision Tree
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
Success?
|
|
108
|
+
├─ Yes → Resource returned?
|
|
109
|
+
│ ├─ Yes → 200 OK
|
|
110
|
+
│ └─ No → Created?
|
|
111
|
+
│ ├─ Yes → 201 Created
|
|
112
|
+
│ └─ No → 204 No Content
|
|
113
|
+
│
|
|
114
|
+
└─ No → Client's fault?
|
|
115
|
+
├─ Yes → Auth issue?
|
|
116
|
+
│ ├─ Yes → Needs login? → 401 Unauthorized
|
|
117
|
+
│ │ └─ Has access? → 403 Forbidden
|
|
118
|
+
│ └─ No → Resource exists?
|
|
119
|
+
│ ├─ No → 404 Not Found
|
|
120
|
+
│ └─ Yes → Valid input?
|
|
121
|
+
│ ├─ No → 400 Bad Request (syntax)
|
|
122
|
+
│ │ 422 Unprocessable (semantic)
|
|
123
|
+
│ └─ Yes → 409 Conflict (state)
|
|
124
|
+
│
|
|
125
|
+
└─ No (Server's fault) → 500/502/503
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Response Format
|
|
129
|
+
|
|
130
|
+
### Standard Response Structure
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
// Success response
|
|
134
|
+
{
|
|
135
|
+
"data": {
|
|
136
|
+
"id": "user_123",
|
|
137
|
+
"type": "user",
|
|
138
|
+
"attributes": {
|
|
139
|
+
"email": "user@example.com",
|
|
140
|
+
"name": "John Doe",
|
|
141
|
+
"created_at": "2024-01-15T10:30:00Z"
|
|
142
|
+
},
|
|
143
|
+
"relationships": {
|
|
144
|
+
"organization": {
|
|
145
|
+
"id": "org_456",
|
|
146
|
+
"type": "organization"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
"meta": {
|
|
151
|
+
"request_id": "req_abc123"
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Collection response
|
|
156
|
+
{
|
|
157
|
+
"data": [...],
|
|
158
|
+
"meta": {
|
|
159
|
+
"total": 100,
|
|
160
|
+
"page": 1,
|
|
161
|
+
"per_page": 20,
|
|
162
|
+
"request_id": "req_abc123"
|
|
163
|
+
},
|
|
164
|
+
"links": {
|
|
165
|
+
"self": "/users?page=1",
|
|
166
|
+
"next": "/users?page=2",
|
|
167
|
+
"last": "/users?page=5"
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Error Response Structure
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"error": {
|
|
177
|
+
"code": "validation_error",
|
|
178
|
+
"message": "The request contains invalid parameters",
|
|
179
|
+
"details": [
|
|
180
|
+
{
|
|
181
|
+
"field": "email",
|
|
182
|
+
"code": "invalid_format",
|
|
183
|
+
"message": "Must be a valid email address"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"field": "age",
|
|
187
|
+
"code": "out_of_range",
|
|
188
|
+
"message": "Must be between 18 and 120"
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
"request_id": "req_abc123",
|
|
192
|
+
"documentation_url": "https://api.example.com/docs/errors#validation_error"
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Error Code Taxonomy
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
authentication_error - Auth token invalid/expired
|
|
201
|
+
authorization_error - User lacks permission
|
|
202
|
+
validation_error - Input validation failed
|
|
203
|
+
not_found - Resource doesn't exist
|
|
204
|
+
conflict - Resource state conflict
|
|
205
|
+
rate_limit_exceeded - Too many requests
|
|
206
|
+
internal_error - Server error (hide details)
|
|
207
|
+
service_unavailable - Temporary outage
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Pagination
|
|
211
|
+
|
|
212
|
+
### Cursor-Based (Recommended)
|
|
213
|
+
|
|
214
|
+
```
|
|
215
|
+
GET /orders?cursor=eyJpZCI6MTIzfQ&limit=20
|
|
216
|
+
|
|
217
|
+
Response:
|
|
218
|
+
{
|
|
219
|
+
"data": [...],
|
|
220
|
+
"pagination": {
|
|
221
|
+
"has_more": true,
|
|
222
|
+
"next_cursor": "eyJpZCI6MTQzfQ"
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**Pros**: Stable with concurrent writes, no offset performance issues
|
|
228
|
+
**Cons**: Can't jump to arbitrary page
|
|
229
|
+
|
|
230
|
+
### Offset-Based
|
|
231
|
+
|
|
232
|
+
```
|
|
233
|
+
GET /orders?offset=40&limit=20
|
|
234
|
+
|
|
235
|
+
Response:
|
|
236
|
+
{
|
|
237
|
+
"data": [...],
|
|
238
|
+
"pagination": {
|
|
239
|
+
"total": 500,
|
|
240
|
+
"offset": 40,
|
|
241
|
+
"limit": 20
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**Pros**: Simple, supports page jumping
|
|
247
|
+
**Cons**: Unstable with writes, slow for large offsets
|
|
248
|
+
|
|
249
|
+
## Filtering and Sorting
|
|
250
|
+
|
|
251
|
+
### Filter Patterns
|
|
252
|
+
|
|
253
|
+
```
|
|
254
|
+
# Simple equality
|
|
255
|
+
GET /users?status=active
|
|
256
|
+
|
|
257
|
+
# Multiple values
|
|
258
|
+
GET /users?status=active,pending
|
|
259
|
+
|
|
260
|
+
# Comparison operators
|
|
261
|
+
GET /orders?total[gte]=100&total[lte]=500
|
|
262
|
+
|
|
263
|
+
# Date ranges
|
|
264
|
+
GET /events?created_at[gte]=2024-01-01&created_at[lt]=2024-02-01
|
|
265
|
+
|
|
266
|
+
# Search
|
|
267
|
+
GET /products?q=laptop
|
|
268
|
+
|
|
269
|
+
# Nested filters (if needed)
|
|
270
|
+
GET /users?organization.plan=enterprise
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Sorting
|
|
274
|
+
|
|
275
|
+
```
|
|
276
|
+
# Single field
|
|
277
|
+
GET /users?sort=created_at
|
|
278
|
+
|
|
279
|
+
# Descending
|
|
280
|
+
GET /users?sort=-created_at
|
|
281
|
+
|
|
282
|
+
# Multiple fields
|
|
283
|
+
GET /users?sort=-created_at,name
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## Versioning Strategies
|
|
287
|
+
|
|
288
|
+
### URL Path Versioning (Recommended)
|
|
289
|
+
|
|
290
|
+
```
|
|
291
|
+
GET /v1/users
|
|
292
|
+
GET /v2/users
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**Pros**: Explicit, easy to route, cache-friendly
|
|
296
|
+
**Cons**: Not "pure" REST
|
|
297
|
+
|
|
298
|
+
### Header Versioning
|
|
299
|
+
|
|
300
|
+
```
|
|
301
|
+
GET /users
|
|
302
|
+
Accept: application/vnd.api+json; version=2
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
**Pros**: Clean URLs
|
|
306
|
+
**Cons**: Hidden, harder to test, cache complexity
|
|
307
|
+
|
|
308
|
+
### Version Lifecycle
|
|
309
|
+
|
|
310
|
+
```
|
|
311
|
+
v1 (deprecated) ─────────> sunset date ───────> removed
|
|
312
|
+
v2 (current) ─────────> stable ────────────> deprecated (when v3)
|
|
313
|
+
v3 (preview) ─────────> stable (becomes current)
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### Breaking vs Non-Breaking Changes
|
|
317
|
+
|
|
318
|
+
| Non-Breaking (Safe) | Breaking (Requires New Version) |
|
|
319
|
+
|---------------------|----------------------------------|
|
|
320
|
+
| Add optional field | Remove field |
|
|
321
|
+
| Add new endpoint | Change field type |
|
|
322
|
+
| Add optional parameter | Change field meaning |
|
|
323
|
+
| Expand enum values | Remove enum value |
|
|
324
|
+
| Relax validation | Tighten validation |
|
|
325
|
+
| Add HTTP method | Change URL structure |
|
|
326
|
+
|
|
327
|
+
## GraphQL Design
|
|
328
|
+
|
|
329
|
+
### Schema Design
|
|
330
|
+
|
|
331
|
+
```graphql
|
|
332
|
+
type User {
|
|
333
|
+
id: ID!
|
|
334
|
+
email: String!
|
|
335
|
+
name: String!
|
|
336
|
+
createdAt: DateTime!
|
|
337
|
+
|
|
338
|
+
# Relationships with pagination
|
|
339
|
+
orders(first: Int, after: String): OrderConnection!
|
|
340
|
+
|
|
341
|
+
# Computed fields
|
|
342
|
+
totalSpent: Money!
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
type OrderConnection {
|
|
346
|
+
edges: [OrderEdge!]!
|
|
347
|
+
pageInfo: PageInfo!
|
|
348
|
+
totalCount: Int!
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
type OrderEdge {
|
|
352
|
+
cursor: String!
|
|
353
|
+
node: Order!
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
type PageInfo {
|
|
357
|
+
hasNextPage: Boolean!
|
|
358
|
+
hasPreviousPage: Boolean!
|
|
359
|
+
startCursor: String
|
|
360
|
+
endCursor: String
|
|
361
|
+
}
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Query Patterns
|
|
365
|
+
|
|
366
|
+
```graphql
|
|
367
|
+
# Good: Specific fields, connection pattern
|
|
368
|
+
query GetUserOrders($userId: ID!, $first: Int!, $after: String) {
|
|
369
|
+
user(id: $userId) {
|
|
370
|
+
id
|
|
371
|
+
name
|
|
372
|
+
orders(first: $first, after: $after) {
|
|
373
|
+
edges {
|
|
374
|
+
node {
|
|
375
|
+
id
|
|
376
|
+
total
|
|
377
|
+
status
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
pageInfo {
|
|
381
|
+
hasNextPage
|
|
382
|
+
endCursor
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
# Avoid: Deeply nested queries without limits
|
|
389
|
+
query Bad {
|
|
390
|
+
users {
|
|
391
|
+
orders {
|
|
392
|
+
items {
|
|
393
|
+
product {
|
|
394
|
+
reviews {
|
|
395
|
+
# This can explode
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### Mutation Patterns
|
|
405
|
+
|
|
406
|
+
```graphql
|
|
407
|
+
# Input types for mutations
|
|
408
|
+
input CreateUserInput {
|
|
409
|
+
email: String!
|
|
410
|
+
name: String!
|
|
411
|
+
organizationId: ID
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
# Consistent mutation response
|
|
415
|
+
type CreateUserPayload {
|
|
416
|
+
user: User
|
|
417
|
+
errors: [UserError!]!
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
type UserError {
|
|
421
|
+
field: String
|
|
422
|
+
message: String!
|
|
423
|
+
code: ErrorCode!
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
mutation CreateUser($input: CreateUserInput!) {
|
|
427
|
+
createUser(input: $input) {
|
|
428
|
+
user {
|
|
429
|
+
id
|
|
430
|
+
email
|
|
431
|
+
}
|
|
432
|
+
errors {
|
|
433
|
+
field
|
|
434
|
+
message
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
## API Security
|
|
441
|
+
|
|
442
|
+
### Authentication
|
|
443
|
+
|
|
444
|
+
| Method | Use Case |
|
|
445
|
+
|--------|----------|
|
|
446
|
+
| **API Keys** | Server-to-server, simple auth |
|
|
447
|
+
| **OAuth 2.0 + OIDC** | User authorization, SSO |
|
|
448
|
+
| **JWT** | Stateless session tokens |
|
|
449
|
+
| **mTLS** | High-security B2B |
|
|
450
|
+
|
|
451
|
+
### Authorization Header
|
|
452
|
+
|
|
453
|
+
```
|
|
454
|
+
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
### Rate Limiting Headers
|
|
458
|
+
|
|
459
|
+
```
|
|
460
|
+
X-RateLimit-Limit: 1000
|
|
461
|
+
X-RateLimit-Remaining: 998
|
|
462
|
+
X-RateLimit-Reset: 1640995200
|
|
463
|
+
Retry-After: 60 (when limited)
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
### Input Validation Checklist
|
|
467
|
+
|
|
468
|
+
- [ ] Validate content-type header
|
|
469
|
+
- [ ] Limit request body size
|
|
470
|
+
- [ ] Validate all input parameters
|
|
471
|
+
- [ ] Sanitize strings for injection
|
|
472
|
+
- [ ] Validate file uploads (type, size)
|
|
473
|
+
- [ ] Prevent mass assignment
|
|
474
|
+
|
|
475
|
+
## Documentation
|
|
476
|
+
|
|
477
|
+
### OpenAPI Specification Structure
|
|
478
|
+
|
|
479
|
+
```yaml
|
|
480
|
+
openapi: 3.1.0
|
|
481
|
+
info:
|
|
482
|
+
title: My API
|
|
483
|
+
version: 1.0.0
|
|
484
|
+
description: |
|
|
485
|
+
# Introduction
|
|
486
|
+
Welcome to the API documentation.
|
|
487
|
+
|
|
488
|
+
## Authentication
|
|
489
|
+
All requests require an API key...
|
|
490
|
+
|
|
491
|
+
servers:
|
|
492
|
+
- url: https://api.example.com/v1
|
|
493
|
+
description: Production
|
|
494
|
+
|
|
495
|
+
paths:
|
|
496
|
+
/users:
|
|
497
|
+
get:
|
|
498
|
+
summary: List users
|
|
499
|
+
operationId: listUsers
|
|
500
|
+
tags: [Users]
|
|
501
|
+
parameters:
|
|
502
|
+
- name: status
|
|
503
|
+
in: query
|
|
504
|
+
schema:
|
|
505
|
+
type: string
|
|
506
|
+
enum: [active, inactive]
|
|
507
|
+
responses:
|
|
508
|
+
'200':
|
|
509
|
+
description: List of users
|
|
510
|
+
content:
|
|
511
|
+
application/json:
|
|
512
|
+
schema:
|
|
513
|
+
$ref: '#/components/schemas/UserList'
|
|
514
|
+
examples:
|
|
515
|
+
default:
|
|
516
|
+
$ref: '#/components/examples/UserListExample'
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
### Documentation Requirements
|
|
520
|
+
|
|
521
|
+
- [ ] All endpoints documented
|
|
522
|
+
- [ ] Request/response examples
|
|
523
|
+
- [ ] Error responses documented
|
|
524
|
+
- [ ] Authentication explained
|
|
525
|
+
- [ ] Rate limits documented
|
|
526
|
+
- [ ] Changelog maintained
|
|
527
|
+
- [ ] Interactive playground
|
|
528
|
+
|
|
529
|
+
## API Design Checklist
|
|
530
|
+
|
|
531
|
+
### Before Building
|
|
532
|
+
|
|
533
|
+
- [ ] Resources and relationships identified
|
|
534
|
+
- [ ] URL structure consistent
|
|
535
|
+
- [ ] HTTP methods appropriate
|
|
536
|
+
- [ ] Response format standardized
|
|
537
|
+
- [ ] Error format defined
|
|
538
|
+
- [ ] Versioning strategy chosen
|
|
539
|
+
- [ ] Authentication mechanism selected
|
|
540
|
+
- [ ] Rate limiting planned
|
|
541
|
+
|
|
542
|
+
### Before Releasing
|
|
543
|
+
|
|
544
|
+
- [ ] OpenAPI spec complete
|
|
545
|
+
- [ ] All endpoints tested
|
|
546
|
+
- [ ] Error handling consistent
|
|
547
|
+
- [ ] Security review complete
|
|
548
|
+
- [ ] Performance benchmarked
|
|
549
|
+
- [ ] Monitoring in place
|
|
550
|
+
- [ ] Deprecation policy documented
|
|
551
|
+
|
|
552
|
+
## Anti-Patterns to Avoid
|
|
553
|
+
|
|
554
|
+
| Anti-Pattern | Better Approach |
|
|
555
|
+
|--------------|-----------------|
|
|
556
|
+
| Verbs in URLs | Use HTTP methods semantically |
|
|
557
|
+
| Inconsistent naming | Establish conventions early |
|
|
558
|
+
| Missing pagination | Always paginate collections |
|
|
559
|
+
| Generic 500 errors | Proper status codes and messages |
|
|
560
|
+
| No request IDs | Include for debugging |
|
|
561
|
+
| Undocumented changes | Maintain changelog |
|
|
562
|
+
| Breaking changes silently | Version and communicate |
|
|
563
|
+
|
|
564
|
+
## Constraints
|
|
565
|
+
|
|
566
|
+
- Always use HTTPS
|
|
567
|
+
- Include request ID in all responses
|
|
568
|
+
- Document all public endpoints
|
|
569
|
+
- Version from day one
|
|
570
|
+
- Never expose internal errors
|
|
571
|
+
- Rate limit all endpoints
|
|
572
|
+
- Validate all input
|
|
573
|
+
|
|
574
|
+
## Related Skills
|
|
575
|
+
|
|
576
|
+
- `backend-developer` - Implementation
|
|
577
|
+
- `frontend-developer` - Consumer perspective
|
|
578
|
+
- `security-engineer` - API security
|
|
579
|
+
- `technical-writer` - Documentation
|