Inferensys

Prompt

Breaking Change Detection Prompt for Package Manifests

A practical prompt playbook for using Breaking Change Detection Prompt for Package Manifests in production AI workflows.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Understand the exact job this prompt performs, the context it requires, and the situations where it should not be used.

This prompt is designed for a developer or platform engineer who is staring at a dependency update pull request and needs to know, with precision, whether merging it will break production. Its job-to-be-done is not to provide a general risk score or a vague compatibility guess. Instead, it performs a targeted comparison: it takes the upstream package's documented breaking changes—extracted from a changelog, release notes, or API diff—and cross-references them against a concrete report of how your codebase actually imports and calls that package. The output is a migration impact list that maps each breaking change to the specific files, functions, and call sites in your repository that are affected. This turns an abstract upstream warning into an actionable, codebase-specific remediation checklist.

To use this prompt effectively, you must provide two grounded inputs. The first is the upstream change evidence, such as a [CHANGELOG_DIFF] or [API_DIFF] that explicitly documents deprecated functions, removed methods, changed signatures, altered return types, or modified default behaviors. The second is a [CODEBASE_USAGE_REPORT], typically generated by a grep, rg, or static analysis tool, that shows every import statement, function call, class instantiation, or type reference your codebase makes against that package. Without both inputs, the prompt cannot perform its core function and will either hallucinate usage or miss critical breakages. This prompt is not a speculative compatibility guesser; it requires grounding against real import usage. It is also not a replacement for running your test suite or performing a canary deployment. Use it as a pre-merge review accelerator that focuses human attention on the highest-risk call sites before CI even runs.

There are clear situations where this prompt is the wrong tool. Do not use it when you lack a precise changelog or API diff—if the upstream maintainer only provides a vague 'bug fixes and improvements' note, the prompt has no evidence to work with and will produce unreliable output. Do not use it to assess transitive dependencies whose code you do not directly import; the codebase usage report will show no direct calls, creating a false sense of safety. Do not use it for runtime behavioral changes that are not surfaced in the API surface, such as performance regressions, memory profile changes, or subtle algorithm modifications. Finally, do not treat its output as a final approval gate. The prompt identifies syntactic and structural breakage risks, but it cannot verify semantic correctness. A function signature may remain compatible while its behavior changes in a way that corrupts data. Always pair this prompt's output with a targeted test run against the identified call sites and, for high-risk updates, a human review of the behavioral changelog entries.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Breaking Change Detection Prompt delivers reliable results and where it creates false confidence. Use these cards to decide whether this prompt fits your current review step before wiring it into a CI pipeline.

01

Good Fit: Semver Major Bumps with Changelogs

Use when: the dependency update is a major version bump and the upstream project publishes a structured changelog or migration guide. The prompt excels at mapping documented breaking changes to your codebase's import statements and call sites. Guardrail: always provide the full changelog text as [CONTEXT] rather than relying on the model's parametric knowledge of the package.

02

Bad Fit: Undocumented Internal APIs

Avoid when: the dependency exposes internal or undocumented APIs that your codebase consumes. The prompt cannot detect breaking changes in functions, classes, or behaviors that are absent from the provided changelog or API diff. Guardrail: pair this prompt with an automated API surface diff tool and feed its output into [CONTEXT] before running the analysis.

03

Required Input: Grounded Import Map

Risk: without a precise map of which files import which package symbols, the prompt produces vague migration advice that wastes developer time. Guardrail: preprocess the codebase to extract a structured import map (file path, imported symbol, usage line) and pass it as [CODEBASE_USAGE]. Never ask the model to guess what your code imports.

04

Operational Risk: Silent Behavioral Changes

Risk: a minor or patch version bump can introduce behavioral changes (changed defaults, performance regressions, subtle output format shifts) that a changelog-based prompt will miss entirely. Guardrail: restrict this prompt to major version reviews. For minor and patch bumps, supplement with automated test suite execution and diff-based behavior comparison.

05

Bad Fit: Transitive-Only Dependency Updates

Avoid when: the update only affects transitive dependencies not directly imported by your code. The prompt's import-usage grounding produces empty results, creating a false sense of safety. Guardrail: use a dedicated transitive reachability prompt for those cases and reserve this prompt for direct dependency manifest changes.

06

Operational Risk: Monorepo Cross-Package Breakage

Risk: in a monorepo, a dependency update in one package can break internal consumers that import from it. The prompt may only analyze the updated package's external API surface. Guardrail: expand [CODEBASE_USAGE] to include all internal consumer packages and flag internal API breaks with the same severity as external ones.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for detecting breaking changes in a dependency update by comparing the package's changelog or API surface against your codebase's actual usage patterns.

This prompt template is designed to be filled programmatically from your package manager, static analysis tooling, and changelog sources before being sent to the model. The goal is not to summarize the changelog, but to produce a migration impact list that maps each breaking change to the specific files and call sites in your codebase that are affected. Replace every [PLACEHOLDER] with data extracted from your CI pipeline or local toolchain. The prompt instructs the model to ground every finding in the provided usage evidence and to abstain when a changelog entry cannot be matched to actual code.

text
You are a dependency update reviewer. Your task is to detect breaking changes in a package update and map them to affected call sites in the codebase.

## PACKAGE UPDATE
- Package: [PACKAGE_NAME]
- Current version: [CURRENT_VERSION]
- Target version: [TARGET_VERSION]
- Release type (major/minor/patch): [RELEASE_TYPE]

## CHANGELOG OR RELEASE NOTES
[CHANGELOG_TEXT]

## CODEBASE USAGE REPORT
This report maps every import from [PACKAGE_NAME] to the files and symbols used.
[USAGE_REPORT]

## INSTRUCTIONS
1. Parse the changelog for entries marked as breaking changes, removals, deprecated APIs, changed defaults, or behavioral modifications.
2. For each breaking change, search the usage report for affected imports, function calls, class instantiations, or configuration usage.
3. If a breaking change has no matching usage in the codebase, mark it as **No Impact** and explain why.
4. If a breaking change matches usage, produce a finding with:
   - **Severity**: BLOCKER (will cause build/runtime failure), HIGH (behavioral change, likely regression), MEDIUM (deprecation, future risk), LOW (cosmetic or unlikely to affect this codebase).
   - **Affected files**: List file paths and line ranges from the usage report.
   - **Migration action**: A specific, actionable step the developer must take.
   - **Evidence**: Quote the relevant changelog line and the matching usage line.
5. If the changelog is ambiguous or the usage report is incomplete, state your confidence as LOW and recommend manual review.
6. Do not invent usage that is not in the usage report. Do not guess about internal package behavior not described in the changelog.

## OUTPUT SCHEMA
Return a JSON object with this exact structure:
{
  "package": "string",
  "version_change": "string",
  "breaking_changes_detected": number,
  "findings": [
    {
      "severity": "BLOCKER | HIGH | MEDIUM | LOW",
      "changelog_entry": "string",
      "affected_files": ["file_path:line_range"],
      "migration_action": "string",
      "evidence": "string",
      "confidence": "HIGH | MEDIUM | LOW"
    }
  ],
  "no_impact_entries": [
    {
      "changelog_entry": "string",
      "reason_no_impact": "string"
    }
  ],
  "recommendations": ["string"],
  "overall_risk": "BLOCKER | HIGH | MEDIUM | LOW",
  "requires_manual_review": boolean
}

Adaptation guidance: The [USAGE_REPORT] placeholder is the most critical input. Generate it by running a static analysis tool (such as grep, rg, ast-grep, or a language server) to find every import of [PACKAGE_NAME] and the specific symbols, function calls, or class references used. For JavaScript/TypeScript, include require() and import statements with their containing file and line. For Python, include import and from ... import statements. The quality of the model's output depends entirely on the completeness of this usage report. If your toolchain cannot produce a reliable usage report, set [USAGE_REPORT] to a clear statement of limitation and expect the model to return "confidence": "LOW" with "requires_manual_review": true. Always run this prompt in a CI context where the changelog can be fetched from the registry or repository, not from a cached or user-provided source.

IMPLEMENTATION TABLE

Prompt Variables

Inputs required for the Breaking Change Detection prompt to produce a reliable migration impact list. Each placeholder must be populated before the prompt is sent. Validation notes describe how to verify the input quality before execution.

PlaceholderPurposeExampleValidation Notes

[CURRENT_MANIFEST]

The package manifest file (e.g., package.json, Cargo.toml) before the update, declaring current dependency versions.

{"dependencies": {"lodash": "4.17.20"}}

Parse as JSON or TOML. Must contain a dependencies or devDependencies map. Reject if empty or unparseable.

[UPDATED_MANIFEST]

The package manifest file after the proposed update, declaring the new dependency versions.

{"dependencies": {"lodash": "4.17.21"}}

Parse as JSON or TOML. Must contain the same top-level dependency keys as [CURRENT_MANIFEST] plus any additions. Reject if identical to [CURRENT_MANIFEST].

[CHANGELOG_ENTRIES]

Relevant changelog or release note text for each updated package, covering the version delta.

"4.17.21: Fixed a prototype pollution vulnerability in setWith and set functions."

Must be non-empty for each package with a version change. If unavailable, set to null and expect reduced confidence in output. Validate that the text references the target version.

[CODEBASE_IMPORTS]

A list of all import statements or require calls in the codebase that reference the updated packages.

["import { setWith } from 'lodash'", "const _ = require('lodash')"]

Extract via static analysis (e.g., grep, AST walk). Must be a complete list for the repository. Reject if empty when [UPDATED_MANIFEST] has changes; an empty list means no usage to analyze.

[API_DIFF_SUMMARY]

A structured diff of the public API surface between the current and updated package versions, if available.

{"removed": ["lodash.oldMethod"], "deprecated": ["lodash.legacyFn"], "signature_changes": [{"fn": "setWith", "old": "(obj, path, value, customizer)", "new": "(obj, path, value)"}]}

Parse as JSON. Can be null if no tooling generates this. If null, the prompt relies entirely on [CHANGELOG_ENTRIES] for breaking change detection, which increases false-negative risk.

[TEST_OUTPUT]

Results from running the existing test suite against the updated dependencies, including failure messages and stack traces.

"FAIL: test_setWith_prototype.js - TypeError: customizer is not a function"

Can be null if tests have not been run. If provided, must be plain text. Validate that the test run completed (not a crash or timeout). Presence of failures increases the prompt's precision for affected call sites.

[PACKAGE_ADVISORIES]

Security advisory data for the updated packages, including CVE IDs, severity, and affected version ranges.

{"CVE-2021-23337": {"severity": "high", "affected": "<4.17.21", "description": "Prototype pollution in lodash"}}

Parse as JSON. Can be null. If provided, each entry must include an affected version range. Used to cross-reference whether the update resolves known vulnerabilities, adding context to migration urgency.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the breaking change detection prompt into a CI pipeline or developer workflow with validation, retries, and human review gates.

This prompt is designed to run inside a CI job triggered by a dependency update pull request. The harness should extract the package manifest diff (e.g., package.json, requirements.txt, Cargo.toml), the corresponding lock file changes, and a static analysis of import usage across the codebase. Feed these as [MANIFEST_DIFF], [LOCKFILE_DIFF], and [IMPORT_USAGE] respectively. The prompt also requires [CHANGELOG_ENTRIES] for the updated packages—pull these from the registry API or a local cache, not from the PR description, to avoid hallucination-prone summaries. The [CODEBASE_LANGUAGE] and [PACKAGE_ECOSYSTEM] variables constrain the model's reasoning to the correct semantic versioning conventions and import resolution rules.

Validation is critical because a false negative here can ship a breaking change to production. After the model returns its JSON output, run a structural validator that checks: (1) every affected_call_site references a file path and line number present in the diff, (2) every breaking_change entry cites a specific changelog line or API signature change, and (3) the migration_impact severity is one of the allowed enum values. If validation fails, retry once with the validation errors appended to [CONSTRAINTS] as explicit negative feedback. If the second attempt also fails, fail the CI check open and post a comment on the PR requesting manual review. Log every prompt version, model, input hash, and validation result for auditability. For high-risk packages (major version bumps, security-critical libraries), add a human approval gate that blocks merge until a designated reviewer acknowledges the breaking change report.

Model choice matters here. Use a model with strong code reasoning and long-context handling, since changelogs and lock file diffs can be large. Claude 3.5 Sonnet or GPT-4o are good defaults. Avoid smaller or older models that may miss subtle API surface changes. Set temperature to 0 or very low (0.1) to maximize deterministic output. If your CI budget is tight, cache the prompt prefix containing the system instruction and output schema, since those are static across runs. The dynamic portion is the diff and changelog data. For teams using RAG, you can pre-index package changelogs and retrieve only the relevant sections rather than passing the full changelog, but ensure the retrieval step doesn't silently drop breaking change notices buried in minor release notes. Finally, wire the structured output into your PR comment or review system so developers see the migration impact list directly in their workflow, not buried in CI logs.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the structure, types, and validation rules for the breaking change detection output. Use this contract to parse, validate, and integrate the model response into CI/CD or review tooling.

Field or ElementType or FormatRequiredValidation Rule

breaking_changes

Array of objects

Must be a JSON array. If no breaking changes are found, the array must be empty, not null or omitted.

breaking_changes[].severity

Enum: 'critical', 'high', 'medium', 'low'

Must match one of the four enum values exactly. Case-sensitive. No custom severities allowed.

breaking_changes[].api_element

String

Must reference a specific function, class, method, interface, or type signature. Cannot be a generic description like 'the API'.

breaking_changes[].change_description

String

Must describe the specific breaking change in one sentence. Must include the before/after behavior or signature difference.

breaking_changes[].affected_call_sites

Array of objects

Must be a JSON array. Each entry must include 'file_path' and 'line_number' fields. If no call sites are found, the array must be empty.

breaking_changes[].affected_call_sites[].file_path

String (relative path)

Must be a valid relative file path from the repository root. Must match an actual file in the provided codebase context.

breaking_changes[].affected_call_sites[].line_number

Integer

Must be a positive integer. Must correspond to a line in the referenced file where the affected API element is used.

breaking_changes[].migration_guidance

String

Must provide a concrete, actionable migration step. Cannot be generic advice like 'update your code'. Must reference the new API or pattern.

breaking_changes[].changelog_reference

String or null

If provided, must be a direct quote or section reference from the package changelog. If null, the field must be explicitly null, not an empty string.

unaffected_usage

Array of objects

If provided, must list API elements used in the codebase that are not affected by breaking changes. Each entry must include 'api_element' and 'confidence' fields.

unaffected_usage[].confidence

Enum: 'confirmed', 'likely', 'uncertain'

Must match one of the three enum values. 'confirmed' requires explicit changelog evidence of no change. 'uncertain' must trigger a manual review flag.

analysis_metadata

Object

Must include 'source_package_name', 'source_package_version', 'target_package_version', and 'analysis_timestamp' fields. All fields are required strings.

analysis_metadata.confidence_overall

Number (0.0 to 1.0)

Must be a float between 0.0 and 1.0 inclusive. Represents overall confidence in the analysis. Values below 0.7 must trigger a human review recommendation.

manual_review_recommended

Boolean

Must be true if any breaking change has severity 'critical', if overall confidence is below 0.7, or if any affected call site is in a security-sensitive path. Otherwise false.

PRACTICAL GUARDRAILS

Common Failure Modes

Breaking change detection prompts fail in predictable ways when the model hallucinates API usage, misses indirect call sites, or cannot reconcile conflicting changelog formats. These cards cover the most common failure patterns and the guardrails that keep the output trustworthy enough for a production dependency review pipeline.

01

Hallucinated Usage Patterns

What to watch: The model invents codebase call sites that don't exist, especially for common library functions like map, filter, or configure. This happens when the prompt asks for usage analysis without providing actual import and call-site data. Guardrail: Always ground the prompt with extracted import statements and grep-style call-site snippets. Require the model to cite specific file paths and line numbers for every flagged breakage. Add a validator that checks cited locations exist in the codebase before surfacing results.

02

Indirect Usage Blindness

What to watch: The model only checks direct imports and misses transitive usage through internal wrappers, facades, or re-exported modules. A breaking change in internal-utils that flows through shared-lib into your app goes undetected. Guardrail: Include the dependency graph or a pre-computed transitive import map in the prompt context. Explicitly instruct the model to trace usage through wrapper modules. Pair with a static analysis pre-processing step that expands all import paths before the prompt runs.

03

Changelog Format Ambiguity

What to watch: The model misinterprets unstructured or inconsistently formatted changelogs, treating a minor deprecation as a breaking change or missing a major API removal buried in prose. Semantic versioning assumptions in the prompt collide with real-world changelog messiness. Guardrail: Pre-process changelogs into a structured schema (breaking, deprecated, added, fixed) before passing to the prompt. When raw changelogs must be used, add explicit instructions to flag ambiguous entries as 'uncertain' rather than guessing. Require confidence scores per finding.

04

Version Delta Scope Creep

What to watch: When a dependency jumps multiple major versions, the model produces an unmanageable list of every breaking change across all intermediate releases, overwhelming reviewers with noise. Critical breakages get buried. Guardrail: Constrain the analysis to the specific version pair being updated (from-to). If the jump is large, break the analysis into sequential version steps or filter to only changes affecting the codebase's actual API surface usage. Add a severity filter that surfaces only high-impact findings by default.

05

False-Negative on Behavioral Changes

What to watch: The model correctly identifies API signature changes but misses behavioral breaking changes—same function signature, different output, changed defaults, or modified error handling. These are the most dangerous because they pass compilation checks. Guardrail: Include changelog sections on 'changed behavior' and 'deprecated defaults' explicitly in the prompt. Add a secondary check that compares default parameter values between versions. Flag any behavioral change note as high-severity regardless of signature stability.

06

Over-Confident Migration Suggestions

What to watch: The model generates plausible but incorrect migration code, suggesting API replacements that don't exist or recommending patterns that introduce subtle bugs. Developers trust the output and apply it without verification. Guardrail: Never present migration code as final. Require the model to cite the upstream migration guide or changelog entry for each suggestion. Add a disclaimer that all migration code must be verified against the package's official documentation. For high-risk changes, route to human review with the original source material attached.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for evaluating the quality of a breaking change detection prompt output before integrating it into a CI/CD pipeline. Each row defines a specific check, its pass standard, failure signals, and a test method to validate the prompt's performance.

CriterionPass StandardFailure SignalTest Method

Call Site Identification Accuracy

All call sites flagged as affected must use an API that is demonstrably changed in the [CHANGELOG] or [API_DIFF].

A flagged call site references a function or class not mentioned in the provided changelog or diff.

Run the prompt on a golden set of 10 dependency updates with known breaking changes. Manually verify each flagged call site against the source changelog. Require 100% precision.

Call Site Recall Completeness

At least 90% of known breaking usages in the [CODEBASE_USAGE] are present in the output's migration impact list.

A known breaking change from the [CHANGELOG] has a corresponding usage in [CODEBASE_USAGE] that is missing from the output.

Use a curated test fixture with injected breaking usages. Compare the prompt's output list against the ground-truth list of affected files and lines. Calculate recall.

Output Schema Validity

The model output is valid JSON that strictly conforms to the provided [OUTPUT_SCHEMA] without any extra keys or malformed fields.

The output is missing the required affected_call_sites array, contains a string instead of an object, or includes extra commentary outside the JSON structure.

Parse the output with a JSON schema validator using the exact [OUTPUT_SCHEMA] definition. The test passes if no ValidationError is raised.

Severity Classification Correctness

The severity field for each finding accurately reflects the breaking_change_type (e.g., 'removed' is 'critical', 'deprecated' is 'warning').

A removed function is classified as 'warning', or a minor signature change is classified as 'critical' without justification.

Create a mapping table from the [CHANGELOG] categories to expected severities. For each finding in the output, assert the severity matches the expected value from the mapping.

Grounding Citation Presence

Every entry in the affected_call_sites array includes a non-empty source_evidence field that quotes the relevant line from the [CHANGELOG] or [API_DIFF].

A finding has an empty string, a hallucinated quote, or a generic statement like 'based on the changelog' in the source_evidence field.

For each finding, extract the source_evidence string and check if it is a substring of the provided [CHANGELOG] or [API_DIFF] input. Fail the test if any citation is not found.

Handling of No Breaking Changes

When the [CHANGELOG] contains only non-breaking entries, the output is a valid JSON object with an empty affected_call_sites array and a summary stating no breaking changes were detected.

The model hallucinates a breaking change, outputs an error message instead of JSON, or fails to produce a valid empty list.

Provide a [CHANGELOG] with only 'Bug Fixes' and 'Features'. Assert that the output JSON has affected_call_sites: [] and a non-alarming summary string.

Transitive Dependency Risk Flagging

If a breaking change is detected in a package that is not a direct dependency in [MANIFEST_FILE], the output's risk_notes field must explicitly flag it as a transitive risk.

A breaking change in a transitive dependency is reported identically to a direct dependency, with no warning in risk_notes about the indirection.

Use a [MANIFEST_FILE] where the breaking package is only present in a [LOCK_FILE]. Verify that the output's risk_notes for that finding contains the substring 'transitive'.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single package and a simplified [CODEBASE_USAGE] block. Remove strict output schema requirements and accept a plain-text migration impact list. Focus on getting the core detection logic right before adding validation layers.

Watch for

  • False positives when the changelog mentions breaking changes that don't affect your actual import paths
  • Missing transitive impact: the prompt may only flag direct API usage and miss breakage in wrapper functions
  • Overly broad "breaking change" classification that flags deprecation warnings as hard breaks
Prasad Kumkar

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.