Inferensys

Prompt

Breaking Change Detection Prompt for Package Updates

A practical prompt playbook for using Breaking Change Detection Prompt for Package Updates 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

Define the job-to-be-done, the ideal user, required context, and the boundaries where this prompt should not be applied.

This prompt is designed for a developer or build engineer who is reviewing a dependency update—typically a pull request from Dependabot, Renovate, or a manual version bump—and needs to understand the breaking changes before merging. The job-to-be-done is not just to list changes from a changelog, but to produce a categorized, severity-ranked, and codebase-grounded impact analysis. The ideal user has access to the package's changelog or release notes, the diff of the dependency manifest, and the repository's own source code. The prompt assumes the model can search or read the codebase to verify whether a breaking change actually affects any call sites.

Use this prompt when the cost of a breaking change slipping into production is high—for example, in shared libraries, API services, or monorepos where a silent API break can cascade across multiple teams. It is particularly valuable when the changelog is long, when the version jump spans multiple major releases, or when the package has a history of undocumented breaking changes. The prompt forces the model to ground every claimed impact in actual codebase evidence, which reduces false positives and prevents unnecessary migration work. It also requires the model to propose concrete migration actions, not just flag problems.

Do not use this prompt for trivial patch updates where the changelog is empty or contains only bug fixes with no API surface changes. It is also inappropriate for initial dependency addition (where there is no existing usage to analyze) or for packages where the source code of the dependency itself is the primary artifact and the changelog is not available. If the repository has no existing imports of the package, the prompt will correctly report zero impact, but a simpler check would suffice. For high-risk production deployments, always pair the model's output with a human review step and, where possible, automated test execution against the actual upgrade before merging.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Breaking Change Detection Prompt delivers reliable value and where it introduces unacceptable risk.

01

Good Fit: Structured Changelogs

Use when: The upstream package provides a machine-readable changelog, a well-maintained CHANGELOG.md, or a detailed GitHub release with explicit breaking change sections. The prompt performs best when breaking changes are explicitly labeled by maintainers. Guardrail: Pre-process the changelog to extract only the version range relevant to the upgrade. Do not feed the entire project history into the prompt.

02

Bad Fit: Implicit Behavioral Changes

Avoid when: The breaking change is undocumented, buried in a closed-source binary, or manifests only as a subtle runtime behavior shift without changelog coverage. The prompt cannot detect what the maintainers did not document. Guardrail: Pair this prompt with a differential test run against the actual dependency versions. If tests pass but behavior changes, the prompt alone is insufficient.

03

Required Input: Repository API Usage Map

What to watch: Without a map of how your codebase actually calls the dependency, the prompt will flag every breaking change as equally severe, creating noise. Guardrail: Pre-compute a call-site index using grep or a static analysis tool. Provide the prompt with a list of functions, classes, or methods your codebase imports from the target package. This grounds severity assessment in real usage.

04

Operational Risk: False Positives

Risk: The model misclassifies a non-breaking addition or a deprecated-but-still-functional API as a breaking change. This causes unnecessary migration work and erodes trust. Guardrail: Require the prompt to cite the exact changelog line for every claimed breaking change. Add a post-processing validation step that checks whether the cited text actually describes a removal or incompatible signature change.

05

Operational Risk: Missed Transitive Breaks

Risk: A direct dependency upgrade pulls in a transitive dependency with its own breaking changes. The prompt only analyzes the changelog you provide. Guardrail: Run this prompt for each direct dependency being upgraded, and separately audit the transitive dependency tree for known vulnerabilities or major version bumps. Do not assume a clean direct changelog means a safe upgrade.

06

Process Fit: Pre-Commit Gate

Use when: Integrating this prompt into a CI pipeline as a non-blocking advisory check on dependency update PRs. The output informs the reviewer but does not auto-merge or auto-reject. Guardrail: Always require human review for any breaking change classified as severity: high or affecting a production-critical code path. The prompt is a triage tool, not an authorization engine.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt for detecting breaking changes in a package update, ready to copy into your AI harness.

This prompt template is designed to be dropped into an AI coding agent or review workflow. It instructs the model to analyze a dependency changelog or diff against your actual repository usage and produce a structured, actionable report. The square-bracket placeholders let you inject the specific package, version range, changelog content, and repository context without rewriting the core logic. Use this as the foundation for a tool-calling agent where the model can request file contents or grep results to ground its analysis.

text
You are a build and dependency analyst. Your task is to review a package update and identify breaking changes that could affect the repository.

## INPUTS
- Package: [PACKAGE_NAME]
- Current version: [CURRENT_VERSION]
- Target version: [TARGET_VERSION]
- Changelog or release notes: [CHANGELOG_CONTENT]
- Repository API usage (imports, calls, type references): [REPO_USAGE_SNIPPETS]

## CONSTRAINTS
- Classify each finding as BREAKING, POTENTIALLY_BREAKING, or NON_BREAKING.
- A change is BREAKING only if it directly affects a code path present in [REPO_USAGE_SNIPPETS].
- A change is POTENTIALLY_BREAKING if it could affect the repository but usage cannot be confirmed from the provided snippets.
- Do not classify a change as breaking based on changelog language alone. You must ground every BREAKING classification in a specific import, call site, or type reference from [REPO_USAGE_SNIPPETS].
- If [REPO_USAGE_SNIPPETS] is empty or insufficient, request the missing information using the available tools before producing the final report.

## OUTPUT SCHEMA
Return a JSON object with the following structure:
{
  "package": "string",
  "version_change": {
    "from": "string",
    "to": "string"
  },
  "breaking_changes": [
    {
      "severity": "BREAKING | POTENTIALLY_BREAKING",
      "change_description": "string",
      "affected_code_paths": ["string"],
      "migration_action": "string",
      "grounding_evidence": "string"
    }
  ],
  "non_breaking_notes": ["string"],
  "recommended_action": "UPGRADE_SAFE | UPGRADE_WITH_MIGRATION | HOLD_AND_REVIEW",
  "confidence": "HIGH | MEDIUM | LOW"
}

## RISK LEVEL
- If any BREAKING change is found, set recommended_action to UPGRADE_WITH_MIGRATION or HOLD_AND_REVIEW.
- If confidence is LOW, recommend HOLD_AND_REVIEW and request human review.

## EXAMPLES
[FEW_SHOT_EXAMPLES]

## TOOLS
You have access to the following tools to gather additional repository context:
[AVAILABLE_TOOLS]

Adaptation guidance: Replace each placeholder with concrete values from your CI pipeline or review tool. The [REPO_USAGE_SNIPPETS] placeholder should be populated by a grep or code-search tool that extracts every import, require, or reference to the target package. If you are wiring this into an agent, map [AVAILABLE_TOOLS] to your actual tool definitions (e.g., file read, grep, AST search). The [FEW_SHOT_EXAMPLES] placeholder should contain 2-3 annotated examples showing correct classification of breaking vs. non-breaking changes with grounding evidence. Start with one example where a removed function is correctly flagged because it appears in the codebase, and one where a changelog mentions a breaking change that does not affect the repository and is correctly classified as NON_BREAKING.

Before shipping: Validate the output against a golden set of known package updates where you have manually verified the breaking changes. Run the prompt against at least 10 real-world updates and measure false positive rate (non-breaking changes misclassified as breaking) and false negative rate (breaking changes missed). If false positives exceed 15%, tighten the grounding requirement by adding explicit instructions that every BREAKING classification must include a direct code reference. If false negatives exceed 5%, expand the [REPO_USAGE_SNIPPETS] extraction to cover more reference patterns (e.g., type annotations, re-exports, dynamic imports). Always require human review for any update classified as UPGRADE_WITH_MIGRATION or HOLD_AND_REVIEW before merging.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Breaking Change Detection prompt. Each placeholder must be populated from repository context, changelog data, or API usage analysis before the prompt is sent. Missing or stale inputs are the most common cause of false positives.

PlaceholderPurposeExampleValidation Notes

[PACKAGE_NAME]

Identifies the dependency being evaluated so the model scopes analysis to one package

react@18.3.0

Must match an actual package.json dependency name. Reject if not found in the repository manifest

[CURRENT_VERSION]

The version currently installed in the repository, used as the baseline for change detection

18.2.0

Must parse as valid semver. Reject if version string does not match lockfile or installed version

[TARGET_VERSION]

The candidate upgrade version being evaluated for breaking changes

19.0.0

Must parse as valid semver and be greater than [CURRENT_VERSION]. Reject if downgrade or same version

[CHANGELOG_CONTENT]

Raw changelog or release notes text from the package maintainers, used as primary evidence for breaking change classification

19.0.0

Breaking Changes

  • Removed legacy context API...

Must be non-empty string. If changelog is unavailable, set to null and add a warning to the prompt output contract. Do not fabricate changelog entries

[REPOSITORY_USAGE_MAP]

Structured list of files and call sites where the package is imported or used, grounding each claimed breaking change in actual code impact

src/components/App.tsx: createRoot, useState src/hooks/useData.ts: useEffect

Must be generated by grep or AST analysis of the repository. Reject if empty when package is listed in dependencies. Each entry must include file path and symbol name

[DEPENDENCY_GRAPH_CONTEXT]

Transitive dependency information showing what depends on this package and what this package depends on, used for impact propagation analysis

{ dependents: ['internal-lib', 'dashboard'], dependencies: ['scheduler@0.23.0'] }

Must be derived from lockfile or dependency graph tool output. Null allowed for packages with no dependents. Reject if graph claims dependents not found in repository

[MIGRATION_GUIDE_URL]

Optional URL to official migration documentation, used to supplement changelog analysis with authoritative guidance

Null allowed. If provided, must be a valid URL and the prompt should instruct the model to reference it alongside the changelog. Do not fabricate URLs

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the breaking change detection prompt into a CI pipeline, dependency review bot, or local developer workflow.

This prompt is designed to operate as a gated analysis step within a dependency update workflow, not as a standalone chatbot query. The typical integration point is a pull request opened by Dependabot, Renovate, or a manual package.json bump. The harness must supply the prompt with three concrete inputs: the full changelog or release notes for the target version range, a repository-wide grep of actual API usage (imports, method calls, type references), and the diff of the lockfile or manifest change. Without these three inputs grounded in the real repository, the model will hallucinate affected code paths or misclassify non-breaking changes as breaking. The prompt expects these inputs to be populated into the [CHANGELOG], [USAGE_GREP], and [LOCKFILE_DIFF] placeholders respectively.

Validation and retry logic is critical because false positives erode trust in automated dependency review. After the model returns its categorized list of breaking changes, a post-processing validator must cross-reference every claimed affected file path against the actual repository tree. If a reported path does not exist, the finding should be discarded or flagged for human review. For high-severity findings, implement a dual-model verification pattern: run the same prompt against a second model (or a different temperature setting) and compare the severity classifications. Findings that disagree between runs should be surfaced to a human reviewer rather than automatically blocking a merge. Log every prompt execution with its inputs, outputs, and validation results to enable retrospective analysis when a breaking change slips through.

Model choice and latency considerations matter here because this prompt runs on every dependency update PR, which can be dozens per week in active repositories. Use a fast, cost-efficient model for the initial triage pass (such as Claude Haiku or GPT-4o-mini) and reserve a more capable model for escalation when the initial pass flags high-severity items or when validation fails. The prompt does not require tool use or retrieval-augmented generation because all evidence is supplied inline, but you should implement a caching layer that stores results keyed by the tuple of (package name, from version, to version, repository commit hash). This prevents re-running the same analysis when multiple PRs touch the same dependency or when a PR is rebased. Finally, wire the output into your CI status check: a green checkmark when no breaking changes are detected, a yellow warning with a summary table for medium-severity items, and a red block with required human approval for high-severity findings.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the exact structure, types, and validation rules for the breaking change detection output. Use this contract to parse, validate, and integrate the model response into your dependency review pipeline.

Field or ElementType or FormatRequiredValidation Rule

breaking_changes

Array of objects

Must be a JSON array. If no breaking changes are found, return an empty array. Validate array length >= 0.

breaking_changes[].severity

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

Must match one of the four enum values exactly. Reject any other string.

breaking_changes[].category

String

Must be a non-empty string. Recommended categories: 'api_removal', 'signature_change', 'behavior_change', 'deprecation', 'dependency_conflict', 'config_change'. Validate against allowed list if strict categorization is required.

breaking_changes[].description

String

Must be a non-empty string between 10 and 500 characters. Must reference a specific symbol, method, or behavior. Reject generic descriptions like 'things changed'.

breaking_changes[].affected_paths

Array of strings

Each string must be a valid relative file path matching the pattern ^[a-zA-Z0-9_/.-]+.[a-zA-Z]+$. Each path must exist in the provided [REPOSITORY_FILE_LIST]. Reject any path not found in the repository context.

breaking_changes[].migration_action

String

Must be a non-empty string between 20 and 1000 characters. Must contain a concrete, actionable step. Reject vague advice like 'update your code'.

breaking_changes[].confidence

Number

Must be a float between 0.0 and 1.0 inclusive. Values below 0.7 should trigger a human review flag in the application layer.

analysis_metadata

Object

Must contain 'source_version', 'target_version', and 'package_name' as non-empty strings. Validate that [TARGET_VERSION] is greater than [SOURCE_VERSION] according to semantic versioning rules.

PRACTICAL GUARDRAILS

Common Failure Modes

Breaking change detection is brittle when the model relies on changelog interpretation alone. These failure modes surface where prompts drift, hallucinate, or misclassify severity—and how to guard against each.

01

False Positives on Non-Breaking Changes

What to watch: The model flags a deprecation warning, internal refactor, or additive API as a breaking change. This inflates severity and wastes triage time. Guardrail: Require the prompt to cite a specific API contract diff or behavioral change. Add an eval check that samples flagged items and verifies they actually break existing call sites.

02

Missed Breaking Changes in Transitive Dependencies

What to watch: The prompt scans only the direct dependency changelog and ignores breaking changes in packages two or more levels deep that propagate to the project's API surface. Guardrail: Include a dependency graph traversal step in the prompt. Validate output against the full lockfile, and add an eval that injects a known transitive breaking change to confirm detection.

03

Severity Inflation Without Usage Context

What to watch: The model assigns high severity to a breaking change in a module the project never imports. This creates noise and erodes trust in the output. Guardrail: Ground every severity rating in actual repository usage. Require the prompt to grep for affected imports, call sites, or type references before assigning severity. Add an eval that checks severity against real code paths.

04

Hallucinated Migration Steps

What to watch: The model invents replacement APIs, flags, or migration commands that don't exist in the package documentation. Developers follow bad advice and break the build. Guardrail: Require every migration action to cite a source line from the upstream changelog, migration guide, or API diff. Add a validator that rejects migration steps without a source reference.

05

Changelog Parsing Failures on Unstructured Formats

What to watch: The model misreads a free-form changelog, markdown table, or GitHub release notes and extracts incorrect version ranges or misattributes changes. Guardrail: Include a pre-processing step that normalizes changelog structure before classification. Add an eval that tests the prompt against intentionally messy changelog formats and checks extraction accuracy.

06

Stale Repository Context After Partial Migration

What to watch: The project has already partially migrated or pinned an older version, but the prompt analyzes against the latest release and reports already-resolved issues as active. Guardrail: Anchor the analysis to the currently installed version from the lockfile, not the latest release. Include a diff between current and target versions. Add an eval that verifies findings are scoped to the actual version delta.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for evaluating the quality of a breaking change detection output before integrating it into a CI/CD pipeline or developer workflow. Each row defines a pass standard, a failure signal, and a concrete test method.

CriterionPass StandardFailure SignalTest Method

Source Grounding

Every breaking change entry cites a specific changelog line, commit SHA, or diff hunk from the source material.

Entries contain claims like 'API signature changed' without a pointer to the source evidence.

Parse the output for a source or evidence field per entry. Validate that each source string matches a real line in the provided [CHANGELOG_DIFF] input using a substring match.

Severity Classification Accuracy

Severity labels (e.g., 'MAJOR', 'MINOR', 'PATCH') align with semantic versioning conventions and the actual impact of the change.

A removal of a public API is labeled 'PATCH', or a deprecation warning is labeled 'MAJOR'.

Maintain a small golden set of 5 known changelog entries with pre-assigned severities. Assert that the model's classification matches the golden label for at least 4 out of 5 entries.

False Positive Rate on Non-Breaking Changes

Non-breaking changes (e.g., new features, bug fixes, internal refactors) are excluded from the 'breaking changes' list.

A changelog entry for 'Added new optional parameter to function X' appears in the breaking changes list.

Inject 3 non-breaking changelog entries into the [CHANGELOG_DIFF] input. Assert that none of these 3 entries appear in the output's breaking changes list.

Affected Code Path Identification

For each breaking change, the output lists specific file paths or symbol names from the repository that are affected.

The output states 'Multiple files may be affected' without listing any concrete paths or symbols.

Provide a mock repository map in [REPO_CONTEXT]. Assert that every file path in the output's 'affected_paths' list exists in the mock map. Fail if the list is empty for a change classified as 'MAJOR'.

Migration Actionability

Each breaking change includes a concrete, step-by-step migration action that a developer can execute.

The migration action is a generic statement like 'Update your code to use the new API.'

Use an LLM-as-judge with a rubric scoring migration action specificity on a 1-5 scale. Fail the test if the average score across all entries is below 3, or if any single entry scores a 1.

Output Schema Compliance

The output is valid JSON that strictly conforms to the defined [OUTPUT_SCHEMA] with all required fields present.

The output is missing the 'severity' field for one entry, or is wrapped in a markdown code fence.

Validate the raw model response against the [OUTPUT_SCHEMA] using a JSON schema validator. Fail on any validation errors.

Hallucination of Non-Existent APIs

The output does not reference any API, function, or class name that is not present in either the provided [CHANGELOG_DIFF] or the [REPO_CONTEXT].

The output suggests migrating a function old_login() that is not mentioned in the changelog or found in the repository context.

Extract all code symbols (function names, class names) from the output. Cross-reference them against a combined symbol list extracted from [CHANGELOG_DIFF] and [REPO_CONTEXT]. Fail if any symbol is not found in the combined list.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Wire the prompt into a CI pipeline that triggers on dependency update PRs. Add a strict JSON output schema with required fields: change_id, category, severity, affected_paths, evidence_in_changelog, migration_action, false_positive_risk. Ground every affected path claim against actual import statements and call sites from the repository by passing a grep or static analysis summary as [REPO_USAGE_CONTEXT].

Add this constraint block:

code
[CONSTRAINTS]
- Every affected_paths entry MUST reference a file path found in [REPO_USAGE_CONTEXT].
- If no repository usage is found for a breaking change, set affected_paths to [] and severity to "NO_IMPACT".
- Do not invent migration steps. If the changelog does not provide migration guidance, set migration_action to "SEE_UPSTREAM_DOCS".

Watch for

  • Silent format drift in JSON output under high token pressure
  • False positives where internal implementation changes are misclassified as breaking API changes
  • Missing human review gate for HIGH severity changes before auto-merge
  • Stale [REPO_USAGE_CONTEXT] that doesn't reflect the current branch state
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.