/oagen:check-emitter-parityfrom oagen
Audits an emitter's coverage of IR fields, producing a structured gap analysis. Use when checking emitter completeness, after updating oagen, or verifying parity.
Ships in oagen. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Audit an emitter's coverage of IR fields — both behavioral and documentation — and produce a structured, priority-tiered gap analysis.
The IR defines fields that fall into two categories:
Emitters should handle every field relevant to their target language. This skill automates the gap analysis by reading the IR types, scanning the emitter implementation, and reporting which fields are covered vs. ignored — grouped by impact priority.
This skill is language-agnostic — it works for any emitter (Node, Ruby, Kotlin, Rust, Python, Go, etc.) by examining the emitter source files rather than assuming any particular output format.
Accept <language> as an argument. If not provided, use AskUserQuestion to ask which language emitter to audit.
Determine required paths:
AskUserQuestion: "Which language emitter do you want to audit?"src/ir/types.ts in the current directory, or node_modules/@workos/oagen/src/ir/types.ts. If neither exists, use AskUserQuestion: "Where is the oagen core package? (absolute or relative path)"project): from argument, or use AskUserQuestion: "Where is your emitter project? (absolute or relative path, e.g. ../oagen-emitters)"{project}/src/{language}/Validate that both the IR types file and the emitter source directory exist before proceeding.
Read src/ir/types.ts from the oagen package. Extract fields dynamically from the interfaces — the list below is a reference guide for known fields, but always check the actual types file for any additions since this list was written.
Every emitter must handle all TypeRef.kind variants in its type-mapping logic. Check that the emitter handles each of these:
primitive — basic types (string, integer, number, boolean, unknown)array — list/array typesmodel — references to model definitionsenum — references to enum definitionsunion — union/variant typesnullable — nullable wrappersliteral — literal value typesmap — dictionary/map typesA missing kind means an entire category of types won't generate correctly.
auth — Authentication schemes, one kind each: basic, bearer, apiKey, oauth2, openIdConnect (with openIdConnectUrl), mutualTLS, and http for any other HTTP scheme (scheme as written, e.g. Digest; compare it with foldHttpAuthScheme). Determines how the client authenticates requests.pagination — Auto-paging iterator generation (cursor, offset, page, link-header strategies; optional endOfIteration stop field)requestBodyEncoding — Body serialization: json (application/json and any concrete +json media type), form-data, form-urlencoded, binary, textrequestBodyRequired — Whether the body argument is mandatory or optionalrequestBodyContentType — The media type to send as Content-Type (the picked entry's essence, application/merge-patch+json)injectIdempotencyKey — Whether to inject an idempotency key header (the Idempotency-Key parameter is left out of headerParams)defaultResponse — The default response: the body type for every status the operation does not list (typically the API's error shape), with its headers, description and contentTypes / contents. Types the errors an operation does not list individually, and the success body of an operation with no explicit 2xx (response is unknown there)rangeResponses — 1XX–5XX range responses, each with the same fields; resolve a status as the explicit entry, then its range, then defaultResponse. A 4XX/5XX body is an error body, folded by default onto the shared shape-named models the explicit codes use (ErrorBody) with the same exceptions as ErrorResponse.type: it stays <Op>Error4Xx under collapseErrorBodies: false and when its shared name is already taken (a component, an enum or another shared body of another shape; the parser warns), stays <Component>Response when a components/responses entry declares it, and is the per-operation enum <Op>Error4Xx in spec.enums under either setting when it is itself an inline enum (or an array of one) — read the name from type; the 2XX body is the success body when no explicit 2xx is declareddiscriminator — Discriminator property and mapping for tagged unionscompositionKind — Whether the union came from allOf (inheritance), oneOf (exclusive), or anyOf (open). Emitters use this to decide serialization strategy.variants — The members of a named union (a component schema that is itself a oneOf/anyOf), one TypeRef per non-null variant; such a model must be emitted as a union of these, not as a data class — its fields are only the inline variants' properties merged as optional fieldscompositionKind — oneOf or anyOf, present exactly when variants isbases — The components the allOf a model is built from names — a component's own, or one written inline at a request, response or error body, a field, array items, map values, a union variant, a parameter, a header or a webhook payload (#755) — one model reference per $ref member, in document order; each model names only its direct bases. An emitter may emit the model as an extension of them, leaving out the fields whose Field.inheritedFrom names one and importing the base itself; ignoring the key emits the complete fields as before. A field the model declares itself over a base's fits it (it admits no value the base's does not: required wherever the base requires it, its type the base's or within it, its limits at least as tight), and a base it does not fit is not listed. The fit is read by the values a type admits, so it is checked for the two spellings that are typed that way and for no other: TypeScript's interface Pet extends Animal { … } compiles, and Animal & { … } types every field as fields does. A parent class in a language whose member types are nominal (Java, C#, Kotlin, Swift, PHP) is not covered: an override there has to keep the member's type, or a subtype of it where the language takes one, and weight: integer over Animal's number, or an enum or a pinned value over its string, keeps Animal in bases though a getter returning Long cannot override one returning Double and an enum is no String. The IR does not mark such a field — like one the model adds, it carries no inheritedFrom — so an emitter that writes a parent class looks up each field without inheritedFrom by name among the fields of each base's model (complete, so what the base inherits in turn is among them), compares the two as its language types them and, where the override would be rejected, either leaves that base out for the model, writing the fields whose inheritedFrom names it as an emitter that ignores the key does, or types the member as the base does — the base's declaration admits every value the model's does — and gives up what the model's narrows (the tighter type, a nested model's further fields)discriminator — Set on a discriminated named union (a oneOf or anyOf with an explicit discriminator: keyword, or a oneOf without the keyword whose variants are all nameable and pin distinct string constants on one property; an anyOf is never discriminated implicitly) and on an allOf+oneOf dispatcher (no variants; the mapping alone names them); generate a dispatcher from property and mapping (IR model names). A named union without one is an undiscriminated union of variantsformat — Format hints like date-time, uuid, email, uri, int64. Determines whether to use language-specific types (e.g., DateTime in Ruby, OffsetDateTime in Kotlin).primitive, literal, array, map, union)constraints — The validation keywords of the schema the type was built from (pattern, minLength, minimum, minItems, uniqueItems, minProperties, …), equal to the field's or parameter's where one carries them and the only place they are for an array's items, a union's variants and a map's values (#545). A model, enum or nullable reference carries none (a nullable's inner does); a type list's union carries them and its variants none. Type a variant or an item from them (a pattern: '^pet_' string as `pet_${string}`), document its form, or validate it before sendingtype — Structured error type for typed exception/error classes: a component model for a $ref body, a model generateModels emits for an inline object body (by default the shared shape-named models ErrorBody, ErrorBodyWithCode, … and the enum ErrorBodyCode, see "Shared error bodies" in docs/architecture/ir-types.md; the per-operation <Op>Error<code> under collapseErrorBodies: false, and under the default too when the shared name is already held by a component, an enum or another shared body of another shape — the parser warns and keeps the per-operation models; a body a components/responses entry declares is never folded and stays <Component>Response), or a <Op>Error<code> enum generateEnums emits for a body that is itself an inline enum (or an array of one) under either setting. Never derive the name from the operation and status code; read it from typeheaders — Declared response headers (e.g. Retry-After on a 429) for typed error accessorsdescription — API-level description for the root client class doc commentexternalDocs — The document's link to fuller documentation (url, optional description), for a @see-style doc tagservers — Server entries (url, description, variables with default/enum/description; resolveServerUrl fills a template's defaults, normalizeServerUrl gives the RFC 3986 form two spellings of one URL share)webhooks — Requests the API sends to its users (OpenAPI 3.1 webhooks), each with a payload type, the headers it carries, and the summary, description and externalDocs an operation hasdescription — Service-level description for resource class doc commentexternalDocs — The tag's link, for the resource class doc commentsummary, description — Method-level doc text (the operation's own summary and description, each falling back to its Path Item's); description never includes the summary, so an emitter that prints only description drops itexternalDocs — The operation's link, for the method doc commentdeprecated — Deprecation marker on methods (the Operation Object's own keyword)async — Async operation markersuccessResponses — Every declared 2xx and 3xx response, set when there is more than one; a 3xx entry's type is unknownresponseHeaders — Headers declared on the primary response (Content-Disposition, Location, ETag, rate limits); each carries description, deprecated and externalDocsresponseDescription — The primary response's description, for a @returns-style doc tagresponseStatusCode — The primary response's status code (200, 201, 204, a lone 302), for an SDK that checks or documents the status it expects; absent when the operation declares no 2xx or 3xx responseresponseContentTypes — Media types the primary response offers (text/html and application/pdf), with a type per media type in responseContents; drives Accept headers and per-format return typesrequestBodyContentTypes — Media types the request body accepts (application/json and text/csv), with a type per media type in requestBodyContents; drives a body argument or serializer per media typerequestBodyDescription — The request body's doc text (the Request Body Object's own, else its picked schema's), for the body argument's doc tag; also on Webhookerrors — Error responses for exception/error documentation (each carries its own description)cookieParams — Cookie parameter handlingtags — The operation's tags in document order, present only when at least one usable entry remains; for grouping or doc commentsservers — Operation-level servers (own, else the Path Item's), present only when they differ from ApiSpec.servers; a request goes to op.servers ?? spec.serversextensions — The Operation Object's own x-* keys, as written, less the ones the parser reads into typed fields (x-pagination, x-oagen-async, the two mutually-exclusive-group keys); for a key the SDK knows (x-idempotent → retry policy, x-since → an @since tag)callbacks — The requests the API sends back to URLs the caller supplied (the Operation Object's callbacks), each a Callback: a Webhook with the key as name and the runtime expression as expression, read exactly as a webhook is, nested callbacks under callbacks again; present only when at least one is readable. Also on Webhook, for a webhook operation's own callbackstype — Every TypeRef kind, a model reference included: an inline object parameter (style: deepObject), or an array, map or union holding one, references a model the parser created (PetsFilter), as a response header's doesdescription — Parameter description contentexternalDocs — The parameter schema's link (falls back to its $ref target), for the param doc tagdeprecated — Deprecated marker on params (true when any of the parameter object, its inline schema or the $ref'd component schema says deprecated: true)default — Default value annotationexample — Example value annotationconstraints — Validation limits (min/max, length, pattern, item counts) for doc comments or argument checksexamples — Every example value (the list example is drawn from)contentType — The media type a content-declared parameter's value is serialized in (application/json): the value must be encoded in it (JSON) rather than by style/explode; absent for a schema parametercontentTypes — Every media type a content-declared parameter's map declares, as written, read or not, for the param doc tag: a map none of whose media types is read has no contentType, and its string value is sent as writtendescription — Model-level doc commentexternalDocs — The schema's link, for the model doc comment (an Enum carries one the same way, component or lifted inline)deprecated — Deprecation marker on models (present, and true, only when the schema the model was built from says deprecated: true — the literal true, any other value sets nothing; never an allOf member's)typeParams — Generic type parametersconstraints — Object-level limits (minProperties, maxProperties, dependentRequired)extensions — The x-* keys of the schema the model was built from, as written, less x-enum-descriptions / x-enumDescriptions; for a key the SDK knows (x-since → an @since tag)inheritedFrom — The direct base (an entry of Model.bases) the field is taken from unchanged; absent when the model declares or changes it (type, required, description or any other key). Lets an emitter that extends the base leave the field to it; a field without it is the model's to write, whether the model adds it or declares it over a base's field of that name (which a parent class has to compare with the base's: see Model.bases)description — Field-level doc commentexternalDocs — The field schema's own link (a $ref sibling's included; a bare $ref yields none unless it names an array or primitive component, or an alias of an enum component, whose link the field carries), for the field doc commentreadOnly — Read-only annotation (language-appropriate: readonly in TS, attr_reader in Ruby, val in Kotlin, etc.)writeOnly — Write-only annotationdeprecated — Deprecation marker on fields (the property schema's own keyword, a $ref sibling included; the referenced model keeps its own, except that a bare $ref to an array or primitive component, or to an alias of an enum component, which has no model, deprecates the field when the component or an alias it passes says deprecated: true, an enum keeping its own flag)default — Default value annotationexample — Example value annotationexamples — Every example value (the list example is drawn from)constraints — Validation limits (min/max, length, pattern, item counts) for doc comments or value checksextensions — The field schema's own x-* keys (a $ref sibling's included; a bare $ref yields none unless it names an array or primitive component, or an alias of an enum component, whose keys the field carries under its own, as it carries that component's externalDocs), as written; for a key the SDK knowsdescription — Enum doc comment (the enum schema's own description: a component enum's, or the inline schema's the enum was lifted from; a collapsed nullable or single-member allOf wrapper's text wins over its branch's)default — The schema's default: value, for a default-value annotationexternalDocs — Link to external documentation, for a @see-style tagdeprecated — Deprecation marker on enums (present, and true, only when the component enum schema says deprecated: true — the literal true, any other value sets nothing; an inline enum carries no flag of its own)extensions — The x-* keys of the schema that declares the members (a component enum's own, or the inline schema's the enum was lifted from), as written, less x-enum-descriptions / x-enumDescriptions; for a key the SDK knowsdescription — Enum value doc comment (a oneOf-of-const member's own description, else the value's x-enum-descriptions / x-enumDescriptions entry)deprecated — Deprecation marker on one enum value (true when the value's const member says deprecated: true; a plain enum: list never sets it)Read all source files in src/{language}/.
Search for switch statements or conditional chains on ref.kind, .kind, or equivalent pattern-matching constructs. Verify that all 8 TypeRef kinds are handled: primitive, array, model, enum, union, nullable, literal, map. Also check for assertNever usage — emitters that use the exhaustive check helper are guaranteed to handle all variants at compile time.
Check a switch or conditional chain over an AuthScheme's kind (spec.auth) the same way, for all 7 kinds: basic, bearer, apiKey, oauth2, openIdConnect, mutualTLS, http. A kind the emitter generates nothing for should be skipped explicitly, not fall through silently.
For each IR field from Step 2, search for references to the field name in the emitter source. Consider a field "covered" if:
op.description, field.readOnly)op.cookieParams, op.successResponses)Use Grep with patterns like \.description, \.externalDocs, \.extensions, \.readOnly, \.writeOnly, \.deprecated, \.default, \.example, \.examples, \.async, \.cookieParams, \.successResponses, \.responseHeaders, \.responseDescription, \.responseContentTypes, \.defaultResponse, \.rangeResponses, \.servers, \.webhooks, \.typeParams, \.pagination, \.auth, \.requestBodyEncoding, \.requestBodyRequired, \.requestBodyDescription, \.requestBodyContentType, \.requestBodyContentTypes, \.injectIdempotencyKey, \.discriminator, \.compositionKind, \.variants, \.bases, \.inheritedFrom, \.contentType, \.format, \.constraints scoped to the emitter source directory.
If the emitter source contains comments like // @oagen-ignore: <field> or similar documented justifications for skipping a field, mark those fields as "intentionally skipped" rather than "missing." These are acceptable gaps — not every field applies to every language.
Spec free-text fields (description on model/field/operation/parameter/enum/enum-value, every value in extensions on operation/model/field/enum, and info.title when it becomes the namespace) are attacker-influenceable. An emitter that interpolates them verbatim into output can be made to emit arbitrary source — a code-execution vector during oagen generate → oagen verify and in published SDKs.
For every covered free-text field, check that the emitter escapes it at the interpolation site:
escapeBlockComment for JS/TS-style /** */ comments; it is specific to languages whose block comments end at */ (JS, TS, Java, C#, Kotlin, Go). Emitters for other comment syntaxes need their own escaping: Python """ docstrings, Ruby #/=begin and other line-comment styles (where an embedded newline starts a new source line), etc.info.title → namespace → client class) must be run through sanitizeIdentifier (or an equivalent) so it cannot break out of the declaration.Report a covered-but-unescaped free-text field as a HIGH-priority security gap, distinct from a missing-coverage gap: the field is handled, but unsafely.
Output a structured report grouped by priority tier:
=== Emitter Parity Report: {language} ===
--- TypeRef Variant Coverage ---
✓ primitive, array, model, enum, union, nullable, literal, map
(all 8 variants handled — uses assertNever exhaustive check)
OR
✗ Missing variants: literal, map
(only 6/8 handled — these type categories will not generate)
--- HIGH PRIORITY (behavioral) ---
✓ ApiSpec.auth → client.{ext}:23
✓ Operation.pagination → resources.{ext}:200
✗ Operation.requestBodyEncoding — not referenced
✗ Operation.injectIdempotencyKey — not referenced
✗ UnionType.discriminator — not referenced
✗ UnionType.compositionKind — not referenced
✗ PrimitiveType.format — not referenced
✗ ErrorResponse.type — not referenced
--- MEDIUM PRIORITY (documentation) ---
✓ ApiSpec.description → client.{ext}:47
✓ Service.description → resources.{ext}:130
✓ Operation.description → resources.{ext}:162
✓ Operation.deprecated → resources.{ext}:168
...
✗ Field.readOnly — not referenced
✗ Field.writeOnly — not referenced
~ Parameter.example — intentionally skipped (// @oagen-ignore: no example support in target)
--- INTENTIONALLY SKIPPED ---
~ Parameter.example — "no example support in target"
SCORE: 18/30 fields covered (60%)
HIGH: 3/8 (38%) ← focus here first
MEDIUM: 15/22 (68%)
For each gap, provide a specific, actionable suggestion for what the emitter should generate in its target language's idiomatic style. Adapt the suggestion to the language's conventions. Group suggestions by priority — HIGH gaps first.
| IR Field | What to Generate |
|---|---|
| Missing TypeRef kinds | Add cases to type-mapping switch; use assertNever for compile-time exhaustiveness |
ApiSpec.auth | Client constructor auth configuration (API key header, bearer token, OAuth flow), with every kind handled or explicitly skipped |
Operation.pagination | Auto-paging iterator/generator that handles cursor, offset, page, or link-header strategies and stops on endOfIteration |
Operation.requestBodyEncoding | Serialize the body to match: multipart handling for form-data, raw bytes for binary (the Content-Type header comes from requestBodyContentType) |
Operation.requestBodyRequired | Make the body argument mandatory when true; when false, make it optional and omit the body only if the caller leaves it out |
Operation.requestBodyContentType | Send it as the Content-Type header, producing parameters such as a multipart boundary yourself |
Operation.injectIdempotencyKey | Generate and attach Idempotency-Key header on applicable requests |
Operation.defaultResponse | Type the error raised for a status errors does not list from defaultResponse.type; use it (after the 2XX range) as the success body when no explicit 2xx is declared |
Operation.rangeResponses | Resolve a status as the explicit entry, then its range, then defaultResponse; type 4XX/5XX errors and a 2XX success body from the range entries |
UnionType.discriminator | Tagged union deserialization using the discriminator property and mapping |
UnionType.compositionKind | Distinguish allOf (merge/inherit) from oneOf (exclusive union) from anyOf (open union) in serialization |
Model.variants | Emit a named union as a union type of its variants (dispatched on Model.discriminator when set), not as a data class of fields |
Model.bases | Emit a composed model as an extension of its bases (interface … extends, an intersection type), leaving out the fields whose inheritedFrom names a base; import the base yourself. For a parent class with nominal member types, first compare each field without inheritedFrom with the base's field of that name: where the override would be rejected, leave that base out for the model or type the member as the base does |
PrimitiveType.format | Map formats to language types (e.g., date-time → DateTime/OffsetDateTime/Time, uuid → UUID) |
ErrorResponse.type | Typed exception/error classes per status code, with the body typed as the model or enum type names, never derived from the operation and status code: by default the shared shape-named ErrorBody models for inline object bodies; <Op>Error<code> under collapseErrorBodies: false and when the shared name is already taken (the parser warns); <Component>Response for a components/responses body; the <Op>Error<code> enum for an inline enum (or array-of-enum) body under either setting |
| IR Field | What to Generate |
|---|---|
ApiSpec.description | Doc comment on the root client class (e.g., YARD # for Ruby, KDoc /** for Kotlin, /// for Rust, docstring for Python) |
ApiSpec.servers | Server URL constants or configuration |
ApiSpec.webhooks | A payload type (or typed handler) per event, keyed by name + httpMethod; the payload model is already in spec.models |
Operation.callbacks | A payload type (or typed handler) per callback beside the method that registers it, keyed by name + expression + httpMethod, never a method of its own; the payload model is already in spec.models (CreatePetPetAdoptedPayload) and assigned to the operation's service; Webhook.callbacks the same, beside the event |
Operation.async | Mark method as async or add async behavior hints (e.g., async in TS/Rust, coroutine in Kotlin, async def in Python) |
Operation.successResponses | Document each 2xx entry's return type; treat a 3xx entry (type is unknown) as a redirect, not a body |
Operation.responseHeaders | Typed accessors for declared response headers (download filename, Location, ETag, rate limits) |
Operation.responseContents | An Accept option per media type (responseContentTypes) and a return type per media type when a response offers several |
Operation.requestBodyContents | A body argument or serializer per media type (requestBodyContentTypes) when a body accepts several |
Operation.requestBodyDescription | Print it as the body argument's doc text (a @param body tag); Webhook.requestBodyDescription documents the payload the same way |
Operation.cookieParams | Document cookie parameters |
Operation.servers | Send the operation's requests to its own server (op.servers ?? spec.servers) instead of the client's base URL |
Parameter.description | Document query/header/cookie params in method doc comments |
Parameter.externalDocs | Link fuller documentation from the param doc tag (e.g. a @see); Field, Model, Enum, Operation, Webhook, Service and ApiSpec carry the same |
Parameter.deprecated | Mark parameter as deprecated in docs |
Model.deprecated | Deprecation marker on the generated type (@deprecated tag, [Obsolete], #[deprecated]) |
Enum.deprecated | Deprecation marker on the generated enum type, as for Model.deprecated |
Operation.extensions | Read the x-* keys the SDK knows (x-idempotent → safe to retry, x-since → an @since tag); Model, Field and Enum carry extensions the same way |
Enum.default | Document the enum's default value |
Parameter.default | Document default value |
Parameter.example | Document example value |
Parameter.examples | Document every example value (e.g. one @example tag each) |
Field.readOnly | Read-only annotation and language-appropriate modifier (readonly in TS, attr_reader in Ruby, val in Kotlin, pub without setter in Rust) |
Field.inheritedFrom | Leave the field to the base it names when the model is emitted as an extension of its bases; emit it as any other field otherwise |
Field.writeOnly | Write-only annotation in doc comments |
Field.default | Document default value |
Field.example | Document example value |
Field.examples | Document every example value (e.g. one @example tag each) |
Field.constraints | Document limits ("at most 100 characters") or validate before serializing |
Parameter.constraints | Document limits on method arguments or validate before sending |
TypeRef.constraints | Type an array's items or a union's variant from its limits (a pattern string as a template-literal type), document their form, or validate them |
Include the specific file and approximate location where each fix should be applied.
The report is printed to stdout. No files are created or modified — this is a read-only audit.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
emitter-audit, ir-coverage, gap-analysis, parity-check, sdk-generation
9 skills in this plugin
/generate-emitterScaffold a new language emitter for oagen, implementing the Emitter interface with idiomatic target-language code generation. Use this skill whenever the user wants to add a new target language, generate SDKs for a new language, add Go/Python/Kotlin/Java/etc. support, create an emitter, or asks about code generation for a language — even if they don't use the word "emitter" explicitly. Also triggers when the user mentions "add language support" or "new SDK target"./generate-extractorScaffold a new language extractor for oagen's compat system, implementing the Extractor interface to extract a live SDK's public API surface. Use when the user wants to add backwards-compatibility support, build an extractor, check for breaking changes or regressions, or asks about extracting an API surface for any language — even if they don't use the word "extractor" explicitly. Also triggers for "compat support", "API surface analysis", or "public surface extraction"./generate-sdkGenerated from the plugin's indexed repository (workos/oagen) — no native marketplace selected
npx claudepluginhub p/workos-oagenOther plugins' skills for the same job