Help us improve
Share bugs, ideas, or general feedback.
From oagen
Verifies generated SDK code preserves backwards compatibility with a live SDK by extracting the public API surface, generating code with a compatibility overlay, and diffing against the baseline to detect breaking changes, regressions, or API surface drift.
npx claudepluginhub workos/oagenHow this skill is triggered — by the user, by Claude, or both
Slash command
/oagen:verify-compatThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Verify that generated SDK code preserves backwards compatibility with a live SDK's public API surface.
Orchestrates end-to-end SDK generation for a target language, handling both backwards-compatible and fresh scenarios by sequencing sub-skills.
Generates type-safe client SDKs in TypeScript, Python, Go, Java from OpenAPI specs with auth, retries, pagination, and tests.
Initializes new SDK projects from OpenAPI specs using speakeasy quickstart command. Targets TypeScript, Python, Go, Java, C#, PHP, Ruby, Kotlin, Terraform.
Share bugs, ideas, or general feedback.
Verify that generated SDK code preserves backwards compatibility with a live SDK's public API surface.
The compat verification workflow extracts the public API surface from a live SDK, generates code with a compatibility overlay that preserves existing names, and then diffs the result against the baseline. Any regressions (renamed methods, changed signatures, missing exports) are reported as violations.
This is the middle tier of the three-tier testing pyramid:
Extractor interface, ApiSurface type, Language Hints referencesrc/compat/language-hints.ts (nodeHints, resolveHints)src/compat/extractors/node.tssrc/compat/overlay.tssrc/compat/differ.tsCheck for node_modules/@workos/oagen/, or src/engine/types.ts in the current directory, otherwise ask.
<language> (run /generate-emitter first)--sdk-path — must be the real, published SDK<language> (run /generate-extractor first), with hints: LanguageHints properly configured for the target languagedocs/sdk-architecture/{language}.md) exists and documents the real SDK's patternsAll artifacts (surface files, generated output) live inside the emitter project — never in /tmp or other throwaway locations. This ensures they persist across sessions and are available to convenience scripts.
Determine required paths:
project): from argument, or detect from CWD (look for src/plugin.ts or oagen.config.ts), or use AskUserQuestionspec): from argument, or use AskUserQuestionsdk_path): from argument, or use AskUserQuestion{project}/sdk-{language}-surface.json — always in the emitter project root{project}/sdk/ — a subdirectory of the emitter projectValidation: The sdk_path MUST NOT be the same as or inside the output directory. If it is, reject it and ask again.
oagen extract --sdk-path {sdk_path} --lang <language> --output {project}/sdk-{language}-surface.json
This produces sdk-{language}-surface.json in the emitter project root — the baseline snapshot of the live SDK's public API.
Gitignore it — it's a derived artifact:
grep -q 'sdk-\*-surface.json' {project}/.gitignore 2>/dev/null || echo 'sdk-*-surface.json' >> {project}/.gitignore
Verify the output via subagent: Use the Agent tool with subagent_type: Explore to spot-check the extraction. This keeps the SDK's source out of the main context:
Explore the SDK at
{sdk_path}. List all public classes and their public method names. Only report what you actually find — no assumptions.
Compare the subagent's findings against <output-path>/sdk-{language}-surface.json. If the surface looks empty or incomplete, the extractor may need fixes — run /generate-extractor to debug.
Scope to API-relevant symbols: The live SDK may export hand-written classes and interfaces that are not derivable from the OpenAPI spec (e.g., CookieSession, PKCE, Webhooks, signature verification utilities, HTTP client abstractions). These are out of scope for compat verification — the emitter isn't expected to generate them.
After extraction, cross-reference the baseline surface against the OpenAPI spec's operations. Symbols that have no corresponding OpenAPI operation should be noted but excluded from the compat score. Report them separately so the user knows what's excluded:
Out of scope (not in OpenAPI spec): CookieSession, PKCE, Webhooks, ...
In scope (API-derived): 280 classes, 1200 interfaces, ...
This prevents the compat score from being diluted by symbols the emitter can't possibly generate. The goal is to measure how well the emitter preserves the API surface, not how completely it replicates hand-written SDK features.
oagen generate --spec {spec} --lang <language> --output {project}/sdk --api-surface {project}/sdk-{language}-surface.json
The emitter receives the overlay via EmitterContext and uses it to preserve existing method names, class names, and type names where possible. The generated output goes to {project}/sdk/, not a temp directory.
IMPORTANT: Always include --spec so the comparison is scoped to spec-derivable symbols only. Without it, the score includes hand-written SDK features (webhooks, PKCE, etc.) that the emitter can't generate, producing a misleadingly low compat score.
oagen verify --spec {spec} --lang <language> --output {project}/sdk --api-surface {project}/sdk-{language}-surface.json
| Category | Meaning |
|---|---|
public-api | A public class, method, or type was renamed or removed |
signature | A method's parameter list or return type changed |
export-structure | A barrel export is missing or reorganized |
behavioral | A behavioral contract changed (e.g., async to sync) |
| Severity | Action |
|---|---|
breaking | Must fix before shipping — this will break consumers |
warning | Review carefully — may be intentional but could surprise consumers |
For each violation:
symbolPath to locate the affected symbolbaseline vs candidate to understand the changeWhen violations can't be auto-fixed: Some violations indicate structural emitter issues (wrong method signature shape, missing exports). These require changing emitter code directly — the overlay loop can only fix naming mismatches, not structural problems. Read the violation details to determine whether this is an overlay issue or an emitter issue.
Repeat Steps 2 and 3 until violations are resolved:
oagen generate --spec {spec} --lang <language> --output {project}/sdk --api-surface {project}/sdk-{language}-surface.json
oagen verify --spec {spec} --lang <language> --output {project}/sdk --api-surface {project}/sdk-{language}-surface.json
Continue until either all violations are resolved (exit 0) or no further improvement is possible (fix the emitter manually).
For languages where backwards compatibility isn't relevant (full rewrites, new SDKs), skip compat verification:
oagen generate --spec <spec> --lang <language> --output <path> --no-compat-check
{project}/sdk-{language}-surface.json — extracted API surface baseline{project}/sdk/ with compat overlay applied