digiqagent 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/.cursor-plugin/plugin.json +29 -0
- package/README.md +197 -0
- package/agents/code-reviewer.md +48 -0
- package/bin/cli.js +210 -0
- package/package.json +41 -0
- package/skills/playwright-test-generator/SKILL.md +563 -0
- package/skills/playwright-test-generator/interaction-test-patterns.md +987 -0
- package/skills/playwright-test-generator/page-object-patterns.md +833 -0
- package/skills/postman-collection-generator/SKILL.md +310 -0
- package/skills/postman-collection-generator/collection-patterns.md +493 -0
- package/skills/postman-test-suite-generator/SKILL.md +653 -0
- package/skills/postman-test-suite-generator/test-scenario-patterns.md +612 -0
- package/skills/receiving-code-review/SKILL.md +213 -0
- package/skills/requesting-code-review/SKILL.md +105 -0
- package/skills/requesting-code-review/code-reviewer.md +146 -0
- package/skills/review-prompts/code-quality-reviewer-prompt.md +26 -0
- package/skills/review-prompts/spec-reviewer-prompt.md +61 -0
- package/skills/swagger-generator/SKILL.md +238 -0
- package/skills/swagger-generator/openapi-patterns.md +667 -0
- package/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/skills/systematic-debugging/SKILL.md +296 -0
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/skills/systematic-debugging/find-polluter.sh +63 -0
- package/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/skills/systematic-debugging/test-academic.md +14 -0
- package/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/skills/test-driven-development/SKILL.md +371 -0
- package/skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/skills/verification-before-completion/SKILL.md +139 -0
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: postman-collection-generator
|
|
3
|
+
description: Use when generating Postman collections from an existing OpenAPI/Swagger spec, codebase routes, or API design document for manual developer testing
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Postman Collection Generator
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Produce a complete, ready-to-import Postman Collection v2.1 JSON file from an OpenAPI spec, codebase analysis, or API design document. Includes organized folders, realistic example data, environment variables, and pre-request scripts.
|
|
11
|
+
|
|
12
|
+
**Core principle:** Developers import, configure the environment, and start testing immediately. Zero guesswork.
|
|
13
|
+
|
|
14
|
+
## When to Use
|
|
15
|
+
|
|
16
|
+
- API has an OpenAPI spec and needs a Postman collection
|
|
17
|
+
- Developer needs to manually test API endpoints
|
|
18
|
+
- No existing Postman collection, or existing one is outdated
|
|
19
|
+
- Before generating test suites (prerequisite for `digiqagent:postman-test-suite-generator`)
|
|
20
|
+
|
|
21
|
+
## Input Detection
|
|
22
|
+
|
|
23
|
+
### Preferred — Existing OpenAPI Spec
|
|
24
|
+
|
|
25
|
+
Check for `openapi.yaml`, `swagger.yaml`, `openapi.json`, or `swagger.json` in the project.
|
|
26
|
+
|
|
27
|
+
If no spec exists, recommend running `digiqagent:swagger-generator` first. A spec ensures nothing is missed.
|
|
28
|
+
|
|
29
|
+
### Alternative — Codebase Scan
|
|
30
|
+
|
|
31
|
+
If no spec is available and the developer wants to skip spec generation, scan the codebase directly using the same framework detection as the swagger-generator skill. Capture endpoints, methods, request/response shapes, and auth requirements.
|
|
32
|
+
|
|
33
|
+
### Alternative — API Design Document
|
|
34
|
+
|
|
35
|
+
Parse a provided requirements or design document to extract endpoints, parameters, and expected behaviors.
|
|
36
|
+
|
|
37
|
+
## Generation Process
|
|
38
|
+
|
|
39
|
+
### Step 1 — Read Source
|
|
40
|
+
|
|
41
|
+
Parse the OpenAPI spec (or codebase/design doc) and extract:
|
|
42
|
+
- Every endpoint: method, path, operationId, summary
|
|
43
|
+
- Parameters: path, query, header — with types and examples
|
|
44
|
+
- Request bodies: schemas with example values
|
|
45
|
+
- Response schemas: for status code validation later
|
|
46
|
+
- Security requirements: which endpoints need auth
|
|
47
|
+
- Server URLs: for environment variable defaults
|
|
48
|
+
|
|
49
|
+
### Step 2 — Organize into Folders
|
|
50
|
+
|
|
51
|
+
Group requests by **tag** (from OpenAPI) or **resource** (from URL path):
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
Collection Root
|
|
55
|
+
├── Auth
|
|
56
|
+
│ ├── Register
|
|
57
|
+
│ ├── Login
|
|
58
|
+
│ └── Refresh Token
|
|
59
|
+
├── Users
|
|
60
|
+
│ ├── List Users
|
|
61
|
+
│ ├── Create User
|
|
62
|
+
│ ├── Get User by ID
|
|
63
|
+
│ ├── Update User
|
|
64
|
+
│ └── Delete User
|
|
65
|
+
├── Products
|
|
66
|
+
│ ├── List Products
|
|
67
|
+
│ ├── Create Product
|
|
68
|
+
│ └── ...
|
|
69
|
+
└── System
|
|
70
|
+
└── Health Check
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Ordering within folders:**
|
|
74
|
+
1. Auth/setup operations first
|
|
75
|
+
2. Create (POST)
|
|
76
|
+
3. List (GET collection)
|
|
77
|
+
4. Get by ID (GET single)
|
|
78
|
+
5. Update (PUT/PATCH)
|
|
79
|
+
6. Delete (DELETE)
|
|
80
|
+
|
|
81
|
+
This ordering mirrors the natural developer workflow: create something, verify it exists, modify it, remove it.
|
|
82
|
+
|
|
83
|
+
### Step 3 — Build Requests
|
|
84
|
+
|
|
85
|
+
For each endpoint, generate:
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"name": "Create User",
|
|
90
|
+
"request": {
|
|
91
|
+
"method": "POST",
|
|
92
|
+
"header": [
|
|
93
|
+
{
|
|
94
|
+
"key": "Content-Type",
|
|
95
|
+
"value": "application/json"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"key": "Authorization",
|
|
99
|
+
"value": "Bearer {{authToken}}"
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
"url": {
|
|
103
|
+
"raw": "{{baseUrl}}/api/users",
|
|
104
|
+
"host": ["{{baseUrl}}"],
|
|
105
|
+
"path": ["api", "users"],
|
|
106
|
+
"query": []
|
|
107
|
+
},
|
|
108
|
+
"body": {
|
|
109
|
+
"mode": "raw",
|
|
110
|
+
"raw": "{\n \"name\": \"Jane Smith\",\n \"email\": \"jane.smith@example.com\",\n \"password\": \"SecureP@ss123\",\n \"role\": \"user\"\n}",
|
|
111
|
+
"options": {
|
|
112
|
+
"raw": {
|
|
113
|
+
"language": "json"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Example data rules:**
|
|
122
|
+
- Use realistic but obviously fake data (not `test`, `foo`, `bar`)
|
|
123
|
+
- Names: `Jane Smith`, `Alex Johnson` — not `string` or `user1`
|
|
124
|
+
- Emails: `jane.smith@example.com` — not `test@test.com`
|
|
125
|
+
- IDs: use `{{userId}}` variables for chained requests
|
|
126
|
+
- Passwords: `SecureP@ss123` — shows valid format
|
|
127
|
+
- Dates: recent realistic dates, not `2000-01-01`
|
|
128
|
+
- Numbers: realistic values (age: 28, price: 49.99)
|
|
129
|
+
|
|
130
|
+
### Step 4 — Add Environment Variables
|
|
131
|
+
|
|
132
|
+
Generate variables using `{{variable}}` syntax:
|
|
133
|
+
|
|
134
|
+
| Variable | Description | Default Value |
|
|
135
|
+
|----------|-------------|---------------|
|
|
136
|
+
| `baseUrl` | API base URL | `http://localhost:3000` |
|
|
137
|
+
| `authToken` | JWT/Bearer token | _(empty, populated by login)_ |
|
|
138
|
+
| `refreshToken` | Refresh token | _(empty, populated by login)_ |
|
|
139
|
+
| `userId` | Current user ID | _(empty, populated by create/login)_ |
|
|
140
|
+
| `resourceId` | Last created resource ID | _(empty, populated by create)_ |
|
|
141
|
+
| `adminToken` | Admin auth token | _(empty, populated by admin login)_ |
|
|
142
|
+
|
|
143
|
+
Add any API-specific variables discovered during analysis (API keys, tenant IDs, etc.).
|
|
144
|
+
|
|
145
|
+
### Step 5 — Include Pre-Request Scripts
|
|
146
|
+
|
|
147
|
+
Add scripts where they enable a smoother workflow:
|
|
148
|
+
|
|
149
|
+
**Collection-level pre-request script** (runs before every request):
|
|
150
|
+
```javascript
|
|
151
|
+
// Auto-refresh token if expired (when refreshToken exists)
|
|
152
|
+
if (pm.environment.get("authToken") && pm.environment.get("tokenExpiry")) {
|
|
153
|
+
const expiry = parseInt(pm.environment.get("tokenExpiry"));
|
|
154
|
+
if (Date.now() >= expiry) {
|
|
155
|
+
console.log("Token expired, refreshing...");
|
|
156
|
+
// Token refresh logic or flag for manual refresh
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**Login endpoint test script** (store token after successful login):
|
|
162
|
+
```javascript
|
|
163
|
+
if (pm.response.code === 200) {
|
|
164
|
+
const response = pm.response.json();
|
|
165
|
+
pm.environment.set("authToken", response.token || response.accessToken);
|
|
166
|
+
if (response.refreshToken) {
|
|
167
|
+
pm.environment.set("refreshToken", response.refreshToken);
|
|
168
|
+
}
|
|
169
|
+
if (response.user && response.user.id) {
|
|
170
|
+
pm.environment.set("userId", response.user.id);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Create endpoint test script** (capture created resource ID):
|
|
176
|
+
```javascript
|
|
177
|
+
if (pm.response.code === 201) {
|
|
178
|
+
const response = pm.response.json();
|
|
179
|
+
pm.environment.set("resourceId", response.id || response.data?.id);
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Step 6 — Write Collection File
|
|
184
|
+
|
|
185
|
+
Output as Postman Collection v2.1 JSON:
|
|
186
|
+
- **Default filename:** `postman_collection.json` at project root
|
|
187
|
+
- **User override:** write to specified path
|
|
188
|
+
|
|
189
|
+
The file must conform to the Postman Collection v2.1 schema:
|
|
190
|
+
|
|
191
|
+
```json
|
|
192
|
+
{
|
|
193
|
+
"info": {
|
|
194
|
+
"name": "<Project Name> API",
|
|
195
|
+
"_postman_id": "<generated-uuid>",
|
|
196
|
+
"description": "<from OpenAPI info.description>",
|
|
197
|
+
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
|
198
|
+
},
|
|
199
|
+
"item": [ /* folders and requests */ ],
|
|
200
|
+
"event": [ /* collection-level scripts */ ],
|
|
201
|
+
"variable": [ /* collection variables */ ]
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Step 7 — Generate Environment File
|
|
206
|
+
|
|
207
|
+
Create a companion `postman_environment.json`:
|
|
208
|
+
|
|
209
|
+
```json
|
|
210
|
+
{
|
|
211
|
+
"name": "<Project Name> - Local",
|
|
212
|
+
"values": [
|
|
213
|
+
{
|
|
214
|
+
"key": "baseUrl",
|
|
215
|
+
"value": "http://localhost:3000",
|
|
216
|
+
"type": "default",
|
|
217
|
+
"enabled": true
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"key": "authToken",
|
|
221
|
+
"value": "",
|
|
222
|
+
"type": "secret",
|
|
223
|
+
"enabled": true
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"key": "refreshToken",
|
|
227
|
+
"value": "",
|
|
228
|
+
"type": "secret",
|
|
229
|
+
"enabled": true
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"key": "userId",
|
|
233
|
+
"value": "",
|
|
234
|
+
"type": "default",
|
|
235
|
+
"enabled": true
|
|
236
|
+
}
|
|
237
|
+
],
|
|
238
|
+
"_postman_variable_scope": "environment"
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
If multiple server URLs exist in the OpenAPI spec, generate separate environment files:
|
|
243
|
+
- `postman_environment_local.json`
|
|
244
|
+
- `postman_environment_staging.json`
|
|
245
|
+
- `postman_environment_production.json`
|
|
246
|
+
|
|
247
|
+
## Developer Workflow
|
|
248
|
+
|
|
249
|
+
Include these instructions in the collection description so developers know what to do:
|
|
250
|
+
|
|
251
|
+
```
|
|
252
|
+
## Getting Started
|
|
253
|
+
|
|
254
|
+
1. Import `postman_collection.json` into Postman
|
|
255
|
+
2. Import `postman_environment.json` as an environment
|
|
256
|
+
3. Select the imported environment in the top-right dropdown
|
|
257
|
+
4. Update `baseUrl` if your server runs on a different port
|
|
258
|
+
5. Run the "Login" request first to populate the auth token
|
|
259
|
+
6. Start testing endpoints — IDs are auto-captured from create responses
|
|
260
|
+
|
|
261
|
+
## Running the Full Collection
|
|
262
|
+
- Click "Run" on the collection folder
|
|
263
|
+
- Use Postman Runner for sequential execution
|
|
264
|
+
- Auth requests run first, populating tokens for subsequent requests
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Red Flags — STOP and Fix
|
|
268
|
+
|
|
269
|
+
| Problem | Fix |
|
|
270
|
+
|---------|-----|
|
|
271
|
+
| Request has hardcoded URL | Use `{{baseUrl}}` variable |
|
|
272
|
+
| Auth token hardcoded in header | Use `{{authToken}}` variable |
|
|
273
|
+
| Request body uses placeholder data (`string`, `0`) | Use realistic example values |
|
|
274
|
+
| No folders — flat request list | Organize by resource/tag |
|
|
275
|
+
| Auth endpoint has no test script to store token | Add token extraction script |
|
|
276
|
+
| Create endpoint doesn't capture ID | Add script to set `{{resourceId}}` |
|
|
277
|
+
| Missing Content-Type header on POST/PUT | Add `Content-Type: application/json` |
|
|
278
|
+
| Environment file missing | Generate it alongside the collection |
|
|
279
|
+
| Path parameters not using variables | Use `{{userId}}` etc. for chained requests |
|
|
280
|
+
|
|
281
|
+
## Verification Checklist
|
|
282
|
+
|
|
283
|
+
Before marking generation complete:
|
|
284
|
+
|
|
285
|
+
- [ ] Every endpoint from the spec/codebase has a corresponding request
|
|
286
|
+
- [ ] Requests organized into logical folders
|
|
287
|
+
- [ ] All URLs use `{{baseUrl}}` variable
|
|
288
|
+
- [ ] Auth endpoints include token-capture test scripts
|
|
289
|
+
- [ ] Create endpoints include ID-capture test scripts
|
|
290
|
+
- [ ] Request bodies have realistic example data
|
|
291
|
+
- [ ] Environment file generated with all necessary variables
|
|
292
|
+
- [ ] Collection imports successfully into Postman (valid JSON)
|
|
293
|
+
- [ ] File written and path confirmed to user
|
|
294
|
+
|
|
295
|
+
Apply `digiqagent:verification-before-completion` — evidence before claims.
|
|
296
|
+
|
|
297
|
+
## Common Patterns
|
|
298
|
+
|
|
299
|
+
See @collection-patterns.md for:
|
|
300
|
+
- Auth flow patterns (login -> token storage -> authenticated requests)
|
|
301
|
+
- CRUD operation ordering
|
|
302
|
+
- Chained request patterns
|
|
303
|
+
- File upload requests
|
|
304
|
+
- Multipart form data
|
|
305
|
+
|
|
306
|
+
## Next Steps
|
|
307
|
+
|
|
308
|
+
After generating the collection:
|
|
309
|
+
1. Use `digiqagent:postman-test-suite-generator` to add positive and negative test scenarios
|
|
310
|
+
2. Developer imports into Postman and runs manually to verify API behavior
|