This prompt is designed for developer relations engineers and API platform teams who need to convert a structured list of breaking API changes into a comprehensive, human-readable migration guide. The ideal input is a validated breaking change diff from a tool like an OpenAPI comparator or a manual contract review. The prompt assumes the breaking changes are already identified, categorized, and accurate—it does not perform the diff itself. The primary job-to-be-done is turning technical change data into a document that API consumers can follow step-by-step, complete with before/after code examples, a prioritized upgrade order for affected endpoints, and clear client-side action items.
Prompt
API Contract Migration Guide Generation Prompt

When to Use This Prompt
Use this prompt when you have a validated breaking change diff and need to produce a consistent, publication-ready migration guide that reduces integration failures for API consumers.
Do not use this prompt when the breaking change list is unverified, incomplete, or speculative. If you haven't confirmed that a change is truly breaking—for example, distinguishing between a field addition (safe) and a type narrowing (breaking)—the guide will propagate errors that cause integration failures downstream. Similarly, this prompt is not a substitute for a breaking change detection tool; pair it with the Breaking Change Detection Prompt for OpenAPI Specs or a manual contract review before feeding changes into this guide generation workflow. For GraphQL, gRPC, or AsyncAPI contracts, use the schema-specific review prompts first to produce the structured change list, then feed that list into this prompt.
Before running this prompt, ensure you have: (1) a validated list of breaking changes with affected endpoints, (2) the previous and current API contract versions for code example generation, (3) client usage data if you need to prioritize endpoints by impact, and (4) your organization's deprecation policy and migration timeline requirements. The output should be reviewed by an engineer familiar with the API surface before publication, especially for changes that affect authentication, pagination, or error handling contracts. After generating the guide, validate completeness by checking that every breaking change in the input list appears in the output, and test the code examples against the current API version to catch syntax or behavioral drift.
Use Case Fit
Where this prompt works and where it does not. Use these cards to decide if the API Contract Migration Guide Generation Prompt fits your workflow before wiring it into a pipeline.
Good Fit: Structured Breaking Change Diffs
Use when: you have a machine-readable diff between two API spec versions (OpenAPI, GraphQL schema, gRPC proto) with breaking changes already identified. Why: the prompt needs a clear, structured list of what broke to produce accurate before/after examples and step-by-step migration steps. Ambiguous or hand-written change notes produce vague guides.
Bad Fit: Undifferentiated Spec Dumps
Avoid when: the input is a raw spec file without any diff analysis. Why: the prompt generates migration guides from known breaking changes, not from raw spec comparison. Pair this prompt with a Breaking Change Detection Prompt first, then feed the detected breaking changes into this guide generation step.
Required Inputs: Breaking Change Inventory
What you must provide: a list of breaking changes with endpoint paths, affected fields, old vs new types or values, and deprecation dates. Guardrail: validate that each breaking change entry includes the affected resource path and the nature of the break before calling this prompt. Missing fields produce incomplete migration steps.
Required Inputs: Client Inventory and Upgrade Order
What you must provide: a list of internal and external clients consuming the affected endpoints, plus the recommended upgrade sequence. Guardrail: without client context, the prompt cannot prioritize migration steps or flag which clients need immediate action. Maintain a client registry as a prerequisite input.
Operational Risk: Stale or Incomplete Examples
Risk: the prompt generates before/after code examples that look plausible but don't match your actual SDK or framework. Guardrail: run generated code examples through a syntax validator and, where possible, a quick compile or lint step. Flag examples that reference deprecated methods or incorrect import paths before publishing.
Operational Risk: Missed Breaking Changes
Risk: the upstream breaking change detector missed a change, so the migration guide omits a critical step. Guardrail: cross-reference the generated guide's endpoint list against a known breaking change inventory. If counts don't match, halt guide publication and re-run detection. Never publish a guide with fewer breaking changes than the detector reported.
Copy-Ready Prompt Template
A reusable prompt template with square-bracket placeholders for generating API contract migration guides from breaking change diffs.
This prompt template is designed for developer relations engineers who need to convert a structured list of breaking API changes into a comprehensive, step-by-step migration guide. The template accepts a breaking change diff, target audience context, and output formatting constraints. It instructs the model to produce a document with before/after code examples, affected endpoints, and a recommended client upgrade order. The placeholders allow you to inject the specific change data, your API's terminology, and any required output schema without modifying the core instruction logic.
textYou are a senior developer relations engineer writing a migration guide for an API upgrade. Your task is to convert the provided breaking change list into a clear, actionable migration document for our API consumers. ## INPUT [BREAKING_CHANGE_DIFF] ## TARGET AUDIENCE [AUDIENCE_CONTEXT] ## OUTPUT STRUCTURE Generate a migration guide with the following sections: 1. **Overview**: A 2-3 sentence summary of the release, the primary breaking changes, and the urgency of the upgrade. 2. **Breaking Changes**: For each breaking change in the input, provide: - **Change Description**: What changed and why. - **Affected Endpoints/Methods**: List specific API paths or SDK methods. - **Before**: A code snippet showing the old usage pattern. - **After**: A code snippet showing the new required usage pattern. - **Client Impact**: Explain what will break if the client does not update. 3. **Recommended Upgrade Order**: A numbered, ordered list of steps a client should follow to safely adopt the new version, starting with the most critical changes. 4. **Deprecation Timeline**: If applicable, map changes to the deprecation schedule provided in [DEPRECATION_SCHEDULE]. ## CONSTRAINTS [CONSTRAINTS] ## EXAMPLES [EXAMPLES] ## OUTPUT FORMAT [OUTPUT_SCHEMA]
To adapt this template, replace each square-bracket placeholder with concrete data. [BREAKING_CHANGE_DIFF] should contain the structured list of changes, typically derived from an OpenAPI diff tool or a manual review. [AUDIENCE_CONTEXT] should describe the typical client, such as 'mobile SDK developers using our Kotlin library' or 'backend engineers integrating with our REST API in Python.' For [CONSTRAINTS], specify rules like 'use only GA features, not beta' or 'code examples must be in TypeScript.' [EXAMPLES] should include one or two high-quality before/after pairs to set the pattern. [OUTPUT_SCHEMA] can be a JSON schema, a Markdown template, or a simple format description. If the migration involves high-risk data changes, add a constraint requiring a warning callout for data-integrity-sensitive steps. Always validate the generated guide against the original breaking change list to ensure no change was omitted or misrepresented.
Prompt Variables
Required inputs for the API Contract Migration Guide Generation Prompt. Each placeholder must be populated before the prompt is assembled and sent to the model. Missing or malformed inputs are the most common cause of incomplete migration guides.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[BREAKING_CHANGE_LIST] | Structured list of breaking changes detected between two API versions | JSON array of objects with fields: endpoint, change_type, before_state, after_state, severity | Must be a non-empty array. Each object requires endpoint and change_type fields. Validate with JSON Schema before prompt assembly. Null or empty array should abort generation. |
[API_SPEC_CURRENT] | The full OpenAPI or equivalent spec for the new target version | Complete OpenAPI 3.1 YAML string for v2 of the Payments API | Must parse as valid OpenAPI 3.x or GraphQL schema. Schema validation failure should block prompt assembly. Minimum requirement: paths, schemas, and info.version must be present. |
[API_SPEC_PREVIOUS] | The full spec for the version clients are migrating from | Complete OpenAPI 3.0 YAML string for v1 of the Payments API | Same format and validation rules as [API_SPEC_CURRENT]. Version must be lower than current spec version. If null, prompt should generate a first-adoption guide instead of a migration guide. |
[CLIENT_SDK_LIST] | Inventory of affected client SDKs and their current spec target versions | JSON array: [{"sdk_name": "payments-python", "current_target_version": "v1", "repo_url": "..."}] | Optional but strongly recommended. If empty or null, the prompt must not fabricate SDK names. Validation: each entry requires sdk_name and current_target_version. Missing repo_url degrades code example specificity. |
[DEPRECATION_POLICY] | Organization's deprecation window policy and sunset header requirements | String: "90-day deprecation window, Sunset header required, migration guide must ship 30 days before removal" | If null, prompt should apply a conservative default (180-day window, Sunset header recommended). Policy string should be checked for contradictory rules (e.g., 30-day window with 60-day guide requirement). |
[OUTPUT_FORMAT] | Target format for the generated migration guide | String enum: "markdown" | "html" | "json" | Must be one of the allowed enum values. Default to "markdown" if null. Invalid values should cause a retry with corrected format before generation. JSON output requires an additional [OUTPUT_SCHEMA] variable. |
[MIGRATION_SCOPE] | Boundary for which breaking changes to include or exclude from the guide | String: "external-clients-only" | "internal-services-only" | "all-consumers" | Must match one of the three enum values. Controls which endpoints appear in the guide and whether internal-only changes are flagged. Null defaults to "all-consumers". Invalid scope should abort generation with a clear error. |
[KNOWN_MIGRATION_PITFALLS] | Previously documented issues or support tickets related to similar migrations | JSON array of strings: ["v1 pagination cursor reuse causes 409 errors", "Python SDK deserialization fails on new enum values"] | Optional. If provided, each pitfall must be cross-referenced in the guide's troubleshooting section. Empty array is valid. Entries without actionable context should be filtered before prompt assembly. |
Implementation Harness Notes
How to wire the migration guide generation prompt into a CI pipeline or documentation workflow with validation, retries, and human review gates.
The API Contract Migration Guide Generation Prompt is designed to run as a step in a release pipeline, triggered when a breaking change diff is approved. The harness should receive a structured diff input—typically the output of a breaking change detection tool—along with the previous and current API spec versions. The prompt produces a draft migration guide, but the harness is responsible for validating that the output covers every breaking change in the input diff before the guide reaches a developer relations engineer for final polish.
Wire the prompt into an application by first constructing the [BREAKING_CHANGE_DIFF] input from your spec comparison tool. This should be a JSON array of change objects, each containing the endpoint path, the changed element (field, enum value, type, parameter), the before/after values, and a severity classification. Pass this alongside [API_NAME], [FROM_VERSION], and [TO_VERSION] into the prompt template. After the model responds, run a completeness validator that extracts all referenced breaking changes from the generated guide and compares them against the input diff. Flag any missing changes for a retry or manual insertion. For high-risk migrations, add a human review gate that requires a DevRel engineer to confirm the before/after code examples are correct and the upgrade order recommendations match known client dependencies. Log every generation with the input diff hash, output guide, completeness score, and reviewer identity for audit trails.
Choose a model with strong instruction-following and long-context handling—GPT-4o or Claude 3.5 Sonnet work well for structured document generation. Set temperature low (0.1–0.2) to reduce variation in code examples and endpoint lists. If the prompt fails completeness validation, implement a single retry with the validator's missing-change list appended as [MISSING_CHANGES] in the prompt context. Do not loop beyond one retry; instead, escalate to a human with the partial output and the gap report. Avoid wiring this prompt directly to a publishing step—always require human approval before the migration guide goes live in documentation.
Expected Output Contract
Fields, format, and validation rules for the generated migration guide. Use this contract to validate the model output before publishing.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
migration_title | string | Must be non-empty and include the source and target API version identifiers | |
overview_summary | string | Must be 2-5 sentences summarizing the breaking changes and migration goal; no markdown headers | |
breaking_changes | array of objects | Each object must contain 'endpoint', 'change_type', 'before_example', 'after_example', and 'severity' fields; array must not be empty | |
affected_endpoints | array of strings | Must list all endpoints with breaking changes; each entry must match an endpoint in [BREAKING_CHANGE_DIFF] | |
client_upgrade_order | array of objects | Each object must have 'client_name', 'upgrade_step', and 'dependency' fields; order must respect dependency constraints from [CLIENT_INVENTORY] | |
before_after_code_examples | array of objects | Each object must contain 'endpoint', 'before_snippet', and 'after_snippet'; snippets must be valid code in the target language specified by [LANGUAGE] | |
rollback_instructions | string | Must describe a concrete rollback path; if no safe rollback exists, must explicitly state 'No safe rollback available' with justification | |
migration_timeline | object | If present, must contain 'deprecation_window', 'hard_cutoff_date', and 'recommended_upgrade_by' in ISO 8601 format |
Common Failure Modes
What breaks first when generating API migration guides from diffs and how to guard against it.
Missing Breaking Changes in the Guide
Risk: The model omits a breaking change that exists in the diff, producing an incomplete migration guide that leaves clients vulnerable to integration failures. This often happens when diffs are large or when changes are spread across many files. Guardrail: Implement a completeness check that extracts all breaking changes from the diff independently and cross-references them against the generated guide. Flag any diff-detected breaking change that does not appear in the output for human review.
Hallucinated Migration Steps
Risk: The model invents before/after code examples or migration steps that do not correspond to actual API changes. This misleads developers and can cause incorrect implementations. Guardrail: Require every code example in the output to be traceable to a specific line or section in the input diff. Add a post-generation validation step that attempts to reverse-map each example back to a source change and flags untraceable content.
Incorrect Client Upgrade Order
Risk: The model recommends an upgrade sequence that causes intermediate states where dependent services break because they expect the old contract while another service has already migrated. Guardrail: Supply a dependency graph as part of the input context and instruct the model to reference it explicitly when ordering steps. Validate the output order against the graph to ensure no step requires a service that has not yet been upgraded.
Ambiguous Before/After Examples
Risk: Migration code snippets use placeholder values, omit required fields, or show only partial payloads, leaving developers uncertain about the exact change required. Guardrail: Include a schema validation pass over all code examples in the output. Each example must parse correctly against the relevant version's schema. Flag any example that fails validation or uses unresolved placeholders.
Version Confusion Across Multiple Breaking Releases
Risk: When the diff spans multiple versions, the model conflates changes from different releases, producing a guide that mixes v2 and v3 migration steps into a single incoherent sequence. Guardrail: Partition the input diff by version boundary before prompting. Generate separate migration sections per version jump and verify that each section references only changes from its corresponding version range.
Deprecation vs. Removal Misclassification
Risk: The model treats a deprecated-but-still-functional field as already removed, instructing developers to drop it immediately when they could migrate gradually. Conversely, it may treat a hard removal as optional. Guardrail: Classify each change as deprecated, removed, or modified before guide generation. Include this classification in the prompt context and validate that the output's urgency and timeline recommendations match the classification for every change.
Evaluation Rubric
Use this rubric to test the quality of the generated migration guide before shipping it to developers. Each criterion maps to a concrete pass standard, a failure signal, and a test method that can be automated or run manually.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Breaking Change Completeness | Every breaking change from the [BREAKING_CHANGE_LIST] input appears in the guide with a dedicated migration step | A known breaking change is missing from the guide; guide references a change not in the input list | Diff the set of breaking change IDs in the input against the set of change IDs mentioned in the guide output; flag missing and hallucinated IDs |
Before/After Code Example Accuracy | Each code example pair shows the correct old API usage and the correct new API usage per the spec diff | Before example uses new API; after example uses old API; example references endpoints or fields not in the spec | Parse code blocks; extract endpoint paths and field names; validate against [OPENAPI_DIFF] source; check that before block matches old spec version and after block matches new spec version |
Affected Endpoint Coverage | Every endpoint impacted by a breaking change is listed with its HTTP method, path, and specific change description | An endpoint with a breaking change is omitted; an unaffected endpoint is incorrectly listed as affected | Extract all endpoint references from the guide; compare against the endpoint impact list derived from [OPENAPI_DIFF]; flag precision and recall gaps |
Client Upgrade Order Correctness | The recommended upgrade order respects dependency constraints: shared libraries before services, internal clients before external consumers | Upgrade order suggests external consumers upgrade before internal dependencies; order contradicts stated dependency graph | Parse the upgrade order section into a directed sequence; validate against [DEPENDENCY_GRAPH] input; flag any topological ordering violations |
Migration Step Actionability | Each migration step contains a concrete action a developer can execute: update a dependency, change a parameter, handle a new error case, or run a specific test | A step contains only vague guidance like 'update your code' or 'check for issues' without specifying what to change or how to verify | Classify each step sentence as actionable or vague using keyword heuristics (verb + object + verification); flag steps with fewer than 2 actionable sentences |
Deprecation Window Documentation | For each deprecated feature, the guide states the deprecation date, the removal target version, and the replacement alternative | A deprecated feature is mentioned without a timeline; removal date is missing; replacement alternative is not specified | For each deprecated feature in [DEPRECATION_SCHEDULE], check that the guide includes date, target version, and replacement; flag missing fields |
Error Response Change Handling | Any breaking change to error response codes or bodies includes guidance on updating client error handling logic | A status code change from 200 to 201 is treated as breaking; a new required error response field is not mentioned in client upgrade steps | Cross-reference error response changes from [OPENAPI_DIFF] against guide content; verify each error contract change has corresponding client handling guidance |
Rollback and Roll-Forward Guidance | The guide includes clear conditions for when to roll back a migration and when to roll forward with a hotfix | No rollback criteria are provided; rollback section is present but references non-existent endpoints or flags | Check for presence of rollback section; validate that rollback conditions reference real feature flags or deployment controls from [DEPLOYMENT_CONFIG]; flag missing or hallucinated controls |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with a single breaking change diff and lighter validation. Skip the client upgrade order and focus on producing one before/after code example per affected endpoint. Accept markdown output without strict schema enforcement.
Prompt modification
Replace [OUTPUT_SCHEMA] with: Return a markdown document with sections: Overview, Breaking Changes (table), Migration Steps (numbered), and Code Examples.
Watch for
- Missing endpoints in the migration guide that were present in the diff
- Code examples that don't actually compile or reflect the new contract
- Overly verbose prose that buries the actual change instructions

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us