This prompt is designed for API platform teams, backend engineers, and release managers who need to assess whether proposed API changes break existing consumers. Use it when you have a concrete diff of API schema changes—from OpenAPI, GraphQL, gRPC, or JSON Schema specifications—and need a structured compatibility assessment before cutting a release. The prompt forces the model to reason about field additions, removals, type changes, enum modifications, and default value shifts, then produce a compatibility matrix with severity ratings and migration guidance. The core job-to-be-done is preventing production incidents where a schema change silently breaks downstream clients, mobile apps, or internal services that depend on your API contract.
Prompt
Backward Compatibility Assessment Prompt for API Changes

When to Use This Prompt
Defines the job-to-be-done, ideal user, required context, and when not to use this prompt for API backward compatibility assessment.
The ideal user has access to a version-controlled API specification and a diff between the current and proposed versions. You should provide the full schema context, not just the changed lines, because the model needs to understand field relationships, required constraints, and nested object structures to accurately assess impact. The prompt works best when you include consumer information—such as which endpoints are actively used, which client versions are in the field, and any telemetry on field usage patterns. Without this context, the model can identify technical breaking changes but cannot prioritize by actual consumer impact. For high-risk APIs in regulated domains, always route the output through human review before accepting the compatibility verdict.
Do not use this prompt when you lack a concrete schema diff or when the change is purely internal with no consumer-facing contract exposure. It is not a substitute for integration tests, contract testing frameworks, or canary deployment analysis. The prompt assesses structural compatibility, not behavioral compatibility—a field type change from integer to string is detectable, but a subtle change in business logic that returns different values for the same input is not. If your API uses semantic versioning, pair this prompt with a version bump recommendation workflow. After running the assessment, validate the output against your own breaking change policy, and use the migration guidance as a starting point for your actual migration documentation, not as the final published guide.
Use Case Fit
Where the Backward Compatibility Assessment Prompt delivers value and where it falls short. Use these cards to decide if this prompt fits your release workflow.
Good Fit: Structured API Contracts
Use when: Your API is defined by OpenAPI, gRPC protobufs, or JSON Schema. The prompt excels at diffing structured contracts to detect field removal, type narrowing, or required-field additions. Guardrail: Always provide the full schema diff, not just a summary, to prevent the model from hallucinating changes.
Bad Fit: Undocumented Runtime Behavior
Avoid when: Breaking changes exist only in undocumented side effects, performance regressions, or implicit behavioral contracts. The prompt cannot detect semantic breaks that aren't visible in the schema. Guardrail: Pair this prompt with integration test results and consumer telemetry before declaring compatibility.
Required Input: Consumer Impact Data
Risk: Without a list of known consumers and their usage patterns, the assessment becomes a theoretical exercise that misses real-world breakage. Guardrail: Provide a consumer registry or API analytics export as [CONSUMER_CONTEXT] so the prompt can estimate blast radius per change.
Operational Risk: False Confidence
Risk: The prompt may produce a clean compatibility report for changes that break clients in practice, such as tightening validation rules or changing error codes. Guardrail: Require human sign-off for any assessment that declares zero breaking changes, and run consumer simulation checks before release.
Good Fit: Pre-Release Gate in CI/CD
Use when: You want an automated compatibility gate that blocks merges when schema changes introduce breaking changes without a migration plan. Guardrail: Integrate the prompt's structured output into your CI pipeline with a strict schema validator that rejects ambiguous or incomplete assessments.
Bad Fit: Single Endpoint Hotfixes
Avoid when: You need a quick compatibility check for a single-field hotfix. The prompt's full-matrix approach adds overhead for trivial changes. Guardrail: For isolated changes, use a lightweight diff checker and reserve this prompt for release-level assessments spanning multiple endpoints.
Copy-Ready Prompt Template
A copy-ready template for assessing the backward compatibility of API changes, ready to be pasted into your AI harness.
This prompt template is the core engine for a backward compatibility assessment. It is designed to be executed by an AI coding agent or an automated pipeline step that has access to your API's schema definitions and the proposed code diff. The template uses square-bracket placeholders for all dynamic inputs, ensuring a clean separation between the instruction set and the data. Before using this prompt, you must have already gathered the relevant OpenAPI/Swagger specs, protobuf definitions, or interface files, and generated a focused diff of the changes.
markdownYou are a principal API architect specializing in backward compatibility. Your task is to analyze a proposed API change and produce a structured compatibility assessment. ## Input Data - **API Contract Diff:** ```diff [API_DIFF]
- Full Current API Schema (for context):
yaml[CURRENT_SCHEMA]
- Consumer Impact Context: [CONSUMER_CONTEXT]
Task
- Classify every change in the diff as
BREAKING,NON-BREAKING, orCLARIFICATION. - For each
BREAKINGchange, determine the severity (CRITICAL,HIGH,MEDIUM,LOW) based on the likelihood and impact of client failure. - Identify all affected endpoints and fields.
- Simulate a consumer's request/response flow before and after the change to illustrate the break.
- Propose a migration path for consumers, including a code snippet if applicable.
- Enumerate edge cases where the change could cause silent data corruption or unexpected errors.
Output Schema
You must respond with a single JSON object matching this exact structure: { "assessment_summary": { "total_changes": <number>, "breaking_changes": <number>, "overall_risk": "CRITICAL" | "HIGH" | "MEDIUM" | "LOW" }, "changes": [ { "change_id": "<unique-slug>", "type": "BREAKING" | "NON-BREAKING" | "CLARIFICATION", "severity": "CRITICAL" | "HIGH" | "MEDIUM" | "LOW" | null, "affected_elements": ["<endpoint/path>", "<field_name>"], "description": "<plain-english description of the change>", "consumer_simulation": { "before": "<example request/response before the change>", "after": "<example request/response after the change, showing the error or altered behavior>" }, "migration_path": { "steps": ["<actionable step for the consumer>"], "code_snippet_before": "<optional code example before migration>", "code_snippet_after": "<optional code example after migration>" }, "edge_cases": ["<description of a potential silent failure or edge case>"] } ] }
Constraints
- Ground every finding in the provided diff and schema. Do not invent changes.
- If a field is marked as deprecated but still present, it is a
NON-BREAKINGchange with a note. - A new required field is a
CRITICALbreaking change. - Changing a field's type (e.g., string to integer) is a
CRITICALbreaking change. - If the diff is empty or contains no API-relevant changes, return an empty
changesarray and anoverall_riskof "LOW".
To adapt this template, replace the placeholders with data from your CI/CD pipeline or local environment. [API_DIFF] should be a unified diff of the proposed schema changes. [CURRENT_SCHEMA] is the full, raw text of the existing API contract. [CONSUMER_CONTEXT] is a critical, often-overlooked field where you should inject known information about how clients use the API—for example, 'Mobile clients cache this field aggressively' or 'This endpoint is only used by an internal admin tool.' This context dramatically improves the severity assessment. After running the prompt, always validate the output JSON against the schema before passing it to a downstream release notes generator or approval dashboard.
Prompt Variables
Each placeholder must be populated for reliable results. Validation notes describe what the model needs to reason correctly.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[API_SPEC_BEFORE] | The OpenAPI, GraphQL, or proto schema representing the current stable API contract | openapi: 3.0.0 paths: /users: get: parameters: - name: status in: query schema: type: string | Must be a valid parseable schema document. If null, the assessment cannot detect field removals or type narrowing. Schema parse check required before prompt execution. |
[API_SPEC_AFTER] | The proposed or new schema version to compare against the baseline | openapi: 3.0.0 paths: /users: get: parameters: - name: status in: query schema: type: string enum: [active, inactive] | Must be a valid parseable schema document. If identical to [API_SPEC_BEFORE], the assessment should return zero breaking changes. Schema parse check required. |
[CONSUMER_PROFILES] | List of known client types, versions, or personas that consume the API and may be impacted | ["mobile-app-v2.1", "web-dashboard-v4", "partner-sdk-python-1.3", "internal-admin-cli"] | Each entry should be a concrete identifier. Empty list is allowed but weakens consumer impact estimation. If null, the prompt should still produce a generic compatibility matrix without consumer-specific severity. |
[CHANGE_CONTEXT] | Natural language description of the intended change, migration rationale, or release notes draft | Adding status enum constraint to /users GET endpoint to improve validation. Previously accepted any string. Mobile app v2.1 and partner SDK filter by status. | Free text. If empty, the model must infer intent solely from schema diffs. Provide this when available to improve migration path recommendations and reduce false-positive breaking change flags. |
[DEPRECATION_POLICY] | The team's deprecation policy including notice periods, sunset timelines, and versioning conventions | Breaking changes require 90-day notice. Field removals must be preceded by deprecation annotation for one major version. Additive changes are non-breaking. | If null, the prompt should apply standard semantic versioning and REST compatibility heuristics. Custom policies override default severity classification. Validate that policy statements are internally consistent. |
[OUTPUT_SCHEMA] | The expected JSON structure for the compatibility assessment output | { "breaking_changes": [...], "non_breaking_changes": [...], "affected_endpoints": [...], "consumer_impact": {...}, "migration_path": {...}, "edge_cases": [...] } | Must be a valid JSON Schema or example structure. If null, the prompt should default to a structured compatibility matrix. Schema validation against this contract is the primary eval gate. Retry if output does not conform. |
[EDGE_CASE_TRIGGERS] | Specific scenarios or client behaviors to simulate during compatibility analysis | ["client sends status=unknown after enum added", "client omits status parameter entirely", "client sends status with unexpected casing"] | Each entry should describe a concrete request scenario. If empty, the model should enumerate edge cases from schema diff analysis. Validate that each listed edge case appears in the output edge_cases array with a compatibility verdict. |
Implementation Harness Notes
How to wire the backward compatibility assessment prompt into a CI/CD pipeline or release workflow.
This prompt is designed to be a gating step in a CI/CD pipeline, running automatically whenever an API specification change is proposed. The ideal integration point is a pull request check that executes after the OpenAPI/Swagger diff is generated but before the change is merged. The prompt consumes a structured diff of the API contract—typically the output of a tool like openapi-diff or a custom JSON comparison script—and produces a compatibility matrix. This matrix should be stored as a pipeline artifact and attached to the PR as a comment or status check, blocking the merge if breaking changes are detected without explicit approval.
To implement, wrap the prompt in a script that first generates the API diff artifact. The script should then call the LLM with the prompt template, injecting the diff into the [API_DIFF] placeholder and the current API version into [CURRENT_VERSION]. The model's response must be validated against a strict JSON schema before the pipeline proceeds. A critical validation step is to ensure that every endpoint listed in the output's affected_endpoints array actually exists in the diff input, preventing hallucinated endpoints. If the severity field for any change is breaking, the pipeline should automatically fail and require a human approval override. For non-breaking changes, the output can be used to auto-populate a migration guide draft in the repository's documentation.
For model choice, a model with strong structured output capabilities and a large context window is required, as API diffs can be verbose. Use a low temperature setting (0.0–0.1) to ensure deterministic, repeatable assessments. Implement a retry loop with a maximum of three attempts if the output fails JSON schema validation. On the second and third retries, append the validation error to the prompt's [CONSTRAINTS] section to guide the model toward a valid structure. Log every assessment, including the raw diff, the model's full response, and the validation result, to an audit trail for release governance. Avoid running this prompt on every commit; trigger it only on pull requests that modify files in designated API specification directories to control cost and noise.
Expected Output Contract
The model must return a JSON object matching this structure. Validate programmatically before accepting the output.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
compatibility_assessment | object | Top-level object must exist and be parseable JSON | |
compatibility_assessment.overall_verdict | enum: BACKWARD_COMPATIBLE | BREAKING | CONDITIONAL | Must be exactly one of the three enum values; reject any other string | |
compatibility_assessment.breaking_changes | array of objects | Must be an array; if overall_verdict is BACKWARD_COMPATIBLE, array must be empty; validate length consistency | |
compatibility_assessment.breaking_changes[].endpoint | string (path pattern) | Must match a valid API path pattern from the input diff; reject fabricated paths not present in source material | |
compatibility_assessment.breaking_changes[].change_type | enum: FIELD_REMOVED | TYPE_CHANGED | CONSTRAINT_ADDED | ENUM_VALUE_REMOVED | PATH_CHANGED | AUTH_CHANGED | Must be exactly one of the defined enum values; reject unknown change types | |
compatibility_assessment.breaking_changes[].severity | enum: CRITICAL | HIGH | MEDIUM | LOW | Must be one of the four severity levels; CRITICAL only for auth changes or data-loss paths | |
compatibility_assessment.breaking_changes[].affected_consumers | array of strings | Must contain at least one consumer identifier; each identifier must be traceable to input context or marked as UNKNOWN if unresolvable | |
compatibility_assessment.migration_recommendations | array of objects | If present, each object must include action (string), timeline (string), and rollback_guidance (string); null allowed when no breaking changes exist |
Common Failure Modes
What breaks first when using AI to assess backward compatibility from API diffs, and how to guard against it.
False Positive: Flagging Additive Changes as Breaking
What to watch: The model misclassifies safe additions (new optional fields, new endpoints) as breaking changes, causing unnecessary alarm and release delays. Guardrail: Include explicit definitions of backward-compatible changes in the prompt. Require the model to cite the specific contract element (field, endpoint, parameter) and the exact compatibility rule violated before flagging.
False Negative: Missing Implicit Contract Breakage
What to watch: The model overlooks semantic breaking changes not visible in the schema diff, such as changed validation rules, stricter rate limits, or altered error response codes. Guardrail: Pair the schema diff with a behavioral changelog or integration test diff. Add a prompt instruction to check for constraint tightening, enum value removal, and status code changes.
Consumer Impact Hallucination
What to watch: The model invents plausible but unsupported claims about how downstream clients will be affected, especially for internal or undocumented consumers. Guardrail: Restrict impact statements to what is provable from the diff alone. Require the output to label any inferred impact as 'speculative' and ground all concrete claims in specific code or schema changes.
Inconsistent Severity Calibration
What to watch: The model assigns 'critical' severity to minor deprecations or 'low' severity to field removals, eroding trust in the assessment. Guardrail: Provide a clear severity rubric in the prompt (e.g., Critical = immediate crash for all consumers; Low = cosmetic deprecation warning). Include few-shot examples of correctly classified changes.
Ignoring Deprecation Windows and Migration Paths
What to watch: The model flags a change as breaking without acknowledging an existing deprecation policy or suggesting a migration path, leaving teams with a problem but no solution. Guardrail: Instruct the model to check for deprecation annotations, sunset headers, or prior changelog entries. Require a 'Migration Path' field in the output schema for every flagged breaking change.
Context Window Truncation on Large Diffs
What to watch: For large API changes spanning many files, the diff exceeds the model's context window, causing it to miss breaking changes in the truncated portion. Guardrail: Chunk the diff by API surface area (e.g., per endpoint or per schema file) and run the assessment in parallel. Aggregate results with a final reconciliation step that checks for cross-cutting concerns.
Evaluation Rubric
Score each output dimension before accepting the assessment into your release pipeline. Use these criteria to gate the prompt's output in an automated eval harness.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Breaking Change Detection Accuracy | All true breaking changes from the diff are identified with correct severity classification | A known breaking change is missing or a non-breaking change is incorrectly flagged as breaking | Diff a golden set of known breaking and non-breaking API changes; compare output to expected labels |
Consumer Impact Assessment | Each affected endpoint includes a concrete client impact description and severity rating | Impact descriptions are generic, missing, or describe server-side effects instead of client-side effects | Parse output for [ENDPOINT] entries; assert each has a non-empty impact field with a valid severity enum value |
Migration Path Completeness | Every breaking change includes a step-by-step migration path with before/after code examples | A breaking change entry lacks migration steps or contains placeholder text instead of actionable guidance | Extract all entries where severity is 'breaking'; assert each has a migration_steps array with at least one step |
Edge Case Enumeration | Output lists at least 3 edge cases per breaking change covering null inputs, boundary values, and concurrent access | Edge cases are fewer than 3, are duplicates, or describe unrelated scenarios | Count edge_cases array length per breaking change entry; assert length >= 3 with unique descriptions |
Schema Field-Level Traceability | Every field change is traced to a specific schema location with before/after type and constraint comparison | Field changes reference incorrect schema paths or omit type change details | Validate each field_change entry has a valid JSON path in the schema_path field and non-null before_type and after_type |
False Positive Rate | Non-breaking additions and deprecations are correctly classified without false breaking-change escalation | A deprecation notice or additive change is incorrectly marked as a breaking change | Run against a test suite of additive-only changes; assert zero entries have severity 'breaking' |
Output Schema Compliance | Output matches the expected [OUTPUT_SCHEMA] exactly with all required fields present and correctly typed | Output is missing required fields, contains extra fields, or has type mismatches | Validate output against the JSON Schema definition; assert validation passes with zero errors |
Confidence Score Calibration | Low-confidence assessments include explicit uncertainty flags and recommend human review | A low-confidence entry lacks an uncertainty flag or a high-confidence entry is factually wrong | Check entries with confidence_score < 0.7; assert uncertainty_flags array is non-empty and human_review_recommended is true |
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 API spec diff and lighter output validation. Replace the full [CONSUMER_REGISTRY] with a static list of known clients. Skip the migration path generation and focus on the compatibility matrix and severity classification.
Prompt snippet
codeAnalyze the following API diff for backward compatibility: [API_DIFF] Return a compatibility matrix with: - Affected endpoints - Breaking change severity (CRITICAL, WARNING, INFO) - Client impact summary
Watch for
- Missed enum additions that are actually breaking
- Over-classifying additive changes as breaking
- No distinction between documented and undocumented surface area

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