Add spec-ingestion agent skill for TypeSpec ingestion workflow#957
Add spec-ingestion agent skill for TypeSpec ingestion workflow#957ShivangiReja wants to merge 8 commits intoopenai:mainfrom
Conversation
|
|
||
| ## Pre-Ingestion | ||
|
|
||
| - [ ] Identify the target area(s) to ingest |
There was a problem hiding this comment.
Should we define what area(s) mean in this context? For example, a specific API capability or client specific capability such as "Responses" or "Realtime".
There was a problem hiding this comment.
The process starts from SKILL.md, which is the entry point that Copilot loads first. It already contains an Available Areas section listing all the areas (e.g., audio, containers, etc.), and file-locations.md has a full mapping table showing how each area maps to its base spec folder, client TSP file, and C# custom code folder.
By the time the agent reaches the checklist, it already has all that context from SKILL.md and the linked documents. The checklist is intentionally lightweight, it's a tracking tool, not meant to be read standalone. I kept the definitions in SKILL.md and file-locations.md to avoid duplicating info across files.
|
|
||
| - [ ] Sparse checkout upstream repo including **both** `{area}` and `common` folders | ||
| - [ ] Copy latest base spec from upstream `packages/openai-typespec/src/{area}/` to `specification/base/typespec/{area}/` — **exact copy, no modifications** | ||
| - [ ] **Keep the clone** until after first successful compile — you may need common types |
There was a problem hiding this comment.
Can we add some more context about what this means? For example, do we mean errors with generation and then subsequent dot net bill after the generation generation is finished?
What does it mean to keep the clone?
There was a problem hiding this comment.
"Keep the clone" means the temporary sparse checkout of microsoft/openai-openapi-pr that we create in Step 2. We keep it around because if TypeSpec compilation (via Invoke-CodeGen.ps1) shows missing types from common/, we need to look them up in the clone's src/common/ folder. Once compile succeeds and we don't need any more upstream files, we delete it. I'll clarify the wording.
| - [ ] Copy latest base spec from upstream `packages/openai-typespec/src/{area}/` to `specification/base/typespec/{area}/` — **exact copy, no modifications** | ||
| - [ ] **Keep the clone** until after first successful compile — you may need common types | ||
| - [ ] If compile shows missing common types, find the type definition in the upstream clone's `src/common/` and copy **only that type definition** into the local `specification/base/typespec/common/` file — do NOT copy the entire file or folder | ||
| - [ ] Delete temporary clone after compile succeeds |
There was a problem hiding this comment.
We should define "compile" here.
There was a problem hiding this comment.
"compile" here means running Invoke-CodeGen.ps1, which internally does npm ci → builds the codegen plugin → runs npx tsp compile .. I'll make that explicit.
| - [ ] Fix errors in `specification/client/{area}.client.tsp` | ||
| - [ ] Add `@@clientLocation` for **all** operations (no more `interface` blocks) | ||
| - [ ] Update `@@clientName` for any renamed operations | ||
| - [ ] Update `@@visibility`, `@@alternateType`, `@@usage` as needed |
There was a problem hiding this comment.
Does the agent know what "as needed" means here?
There was a problem hiding this comment.
Yes, the agent determines "as needed" from compile errors, if a decorator references a type/property that was renamed or removed upstream, the compile will fail with an error pointing to the broken reference. I'll reword to make the trigger explicit.
| - [ ] Add `@@clientLocation` for **all** operations (no more `interface` blocks) | ||
| - [ ] Update `@@clientName` for any renamed operations | ||
| - [ ] Update `@@visibility`, `@@alternateType`, `@@usage` as needed | ||
| - [ ] Update client models TSP (`specification/client/models/{area}.models.tsp`) if applicable |
There was a problem hiding this comment.
Should we define the criteria for "if applicable"?
There was a problem hiding this comment.
A client models file exists only for areas that need discriminated union wrappers or .NET-specific model overrides. The criteria is: check if specification/client/models/{area}.models.tsp exists. If it does, update it if needed. If it doesn't, skip this step.
| - [ ] List all **new** types, properties, and operations | ||
| - [ ] List all **renamed** types/properties (old → new mapping) | ||
| - [ ] List all **removed** types, properties, and operations | ||
| - [ ] Note any **type unions** that need discriminator treatment (don't modify base spec) |
There was a problem hiding this comment.
Where should these be listed or noted?
There was a problem hiding this comment.
These should be listed in the final summary that the agent presents to the user at the end (the "Final Summary" section at the bottom of the checklist). The agent compiles these lists as it works through the steps and includes them in its output.


Summary
[Local work only]
Adds a new agent skill at spec-ingestion that documents the full process for ingesting the latest OpenAI TypeSpec specification from upstream (
microsoft/openai-openapi-pr) into theopenai-dotnetSDK.This skill is best suited for ingesting simple areas such as
containers,images,embeddings,models,moderations..etc. It may still need some manual work but it will do most of the heavy lifting. More complex areas (e.g., responses, assistants, realtime) require manual work beyond what this skill covers.This is intended as a living document — it should be updated as new areas are ingested, refining steps, adding new patterns, and capturing lessons learned to make the process smoother over time.
What's included
The skill is composed of 6 files:
Key principles encoded
npx tsp compilenpm installbefore compiling or generating@@clientLocationrequired — latest spec no longer usesinterfaceblocks