You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refine skill based on test results against real PRs
Tested against intercom/intercom#474982 (field addition) and #477688
(new endpoint). Both produced correct output matching human-written PRs.
Improvements based on test observations:
- Add fern check fallback (python YAML validation) for environments
without fern installed
- Add guidance to extract descriptions from version change define_description
- Add guidance to match example verbosity level of sibling endpoints
- Add guidance to reuse existing example value styles (IDs, workspace IDs)
- Note common YAML validation pitfalls
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: .claude/skills/generate-openapi-from-pr/SKILL.md
+14-3Lines changed: 14 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -127,6 +127,7 @@ Read the target spec file(s) to understand:
127
127
- The `intercom_version` enum (to verify version values)
128
128
- Where to insert new paths/schemas (maintain alphabetical or logical grouping)
129
129
-**All inline examples that reference the affected schema** — when adding a field, you must update every response example that returns that schema. Search with: `grep -n 'schemas/<name>' <spec_file>`
130
+
-**Existing example values** for the same resource — reuse the same style of IDs, workspace IDs, timestamps, and names that nearby endpoints use. Consistency matters more than novelty.
Every endpoint needs: `summary`, `description`, `operationId` (unique, camelCase), `tags`, `Intercom-Version` header parameter (`"$ref": "#/components/schemas/intercom_version"`), response with inline examples + schema `$ref`, and at minimum a `401 Unauthorized` error response. POST/PUT endpoints also need a `requestBody` with schema and examples. See [./openapi-patterns.md](./openapi-patterns.md) for complete templates.
151
152
153
+
**Writing good descriptions:** Extract the description from the PR's version change `define_description` if available — it's usually well-written for the changelog. Supplement with details from the controller (constraints, validations, edge cases). A good description explains what the endpoint does AND when you'd use it, not just "You can do X."
154
+
155
+
**Response example detail level:** Match the verbosity of existing examples for the same schema. If other ticket endpoints show a full ticket object with nested `ticket_parts`, `contacts`, and `linked_objects`, your example should too. If they're minimal (just `type` and `id`), keep yours minimal. Look at the nearest sibling endpoint for the right level of detail.
156
+
152
157
#### Quick checklist for new schemas
153
158
154
159
Every schema needs: `title` (Title Case), `type: object`, `x-tags`, `description`, and `properties` where each property has `type`, `description`, and `example`. Mark nullable fields explicitly with `nullable: true`. Timestamps use `type: integer` + `format: date-time`.
@@ -169,7 +174,12 @@ Run Fern validation:
169
174
fern check
170
175
```
171
176
172
-
If validation fails, read the error output and fix the issues.
177
+
If `fern` is not installed, fall back to YAML syntax validation:
If validation fails, read the error output and fix the issues. Common problems: indentation errors, missing quotes on string values that look like numbers, and duplicate keys.
173
183
174
184
### Step 9: Summarize
175
185
@@ -195,8 +205,9 @@ Always remind the user of remaining manual steps:
195
205
## Important Notes
196
206
197
207
-**Do NOT run `fern generate` without `--preview`** — this would auto-submit PRs to SDK repos
198
-
-**Examples must be realistic** — use plausible IDs, emails, timestamps
199
-
-**Match existing style** — look at nearby endpoints for naming and formatting conventions
208
+
-**Match existing examples** — before writing new example values, look at how nearby endpoints for the same resource format their examples. Reuse the same style of IDs (`'494'` not `'1'`), workspace IDs (`this_is_an_id664_that_should_be_at_least_`), timestamps (recent UNIX timestamps like `1719493065`), and names. Consistency across the spec is more important than creativity.
209
+
-**Match existing style** — look at nearby endpoints for naming, formatting, and level of detail in response examples. If sibling endpoints show full nested objects, yours should too.
210
+
-**Extract descriptions from the PR** — the version change's `define_description` is usually well-written. Use it as the basis for your endpoint description, then enrich with constraints and edge cases from the controller code.
200
211
-**Cross-reference with existing schemas** — reuse `$ref` to existing schemas wherever possible
201
212
-**Nullable fields** — always explicitly mark with `nullable: true`
202
213
-**The `error` schema** is already defined — always reference it with `"$ref": "#/components/schemas/error"`
0 commit comments