Direct answer
Pick the version increment from what a consumer can rely on, not from how large the diff was. List the behaviors an outside caller depends on, compare that list before and after the change, and assign major, minor, or patch from the observed impact. The official Semantic Versioning 2.0.0 specification assigns a major increment to incompatible API changes, a minor increment to backward-compatible additions, and a patch increment to compatible bug fixes (F073). A thousand-line internal refactor that no caller can detect is a patch candidate. A one-line rename of an exported function is a major release.
This article gives you a classification method, three decision tables, and a way to make Claude Code challenge your call before you tag. It does not give you a formula that removes judgment. The specification itself says the classification depends on the declared public API and the compatibility expectations the project has published, so two honest teams can defend different increments for the same diff (F073).
Define the public compatibility surface
Start by writing down what outside code can touch. That list is the compatibility surface, and every version decision is a claim about it.
A library surface usually includes exported functions and classes, their parameter order and types, return shapes, raised errors, configuration keys, and any file or wire format the consumer reads. A service surface adds HTTP routes and status codes, request and response bodies, authentication behavior, and event payloads. A CLI surface includes command names, flags, exit codes, and stdout shapes that scripts parse.
The boundary that matters is the one consumers actually use, which can be wider than the boundary the authors intended. A field that was never documented but that three integrators read is part of the effective surface. This is the gap that consumer-driven contract testing tools address: Pact describes contracts as agreements between a consumer and a provider about the messages between them, which makes the depended-on behavior explicit rather than assumed (Pact documentation, official).
Record the surface before you classify anything. A change you cannot map to a surface entry is either internal or undocumented, and undocumented behavior is exactly where surprise breaking changes live.
List consumer-visible changes
Turn the diff into a list of observable differences. Work through the public surface entry by entry and ask what a caller would see before and after.
The useful unit is the observable difference, not the commit. A single commit can carry two changes with different compatibility impact, and a rename split across ten commits is still one observable rename.
| Consumer-visible change | Before behavior | After behavior | Compatibility |
|---|---|---|---|
Exported function parseConfig is renamed to loadConfig |
Callers import parseConfig |
Old export is gone | Breaking |
| New optional keyword argument with a default | Callers omit the argument | Callers omit it and get the default | Compatible addition |
Validation rejects an empty region value |
Empty region was accepted and defaulted |
Request now fails with a 400 | Breaking for those callers |
Internal helper normalize is deleted |
Only in-repo callers used it | No consumer code changes | Compatible bug fix or internal |
| Error message text is reworded | Message read invalid input |
Message reads region must not be empty |
Depends on whether consumers parse text |
| Bug fix restores documented sort order | Order contradicted the docs | Order matches the docs | Compatible bug fix |
The last two rows show why the declared surface is the reference. Text that consumers parse is part of the surface even when nobody meant it to be. Text nobody reads is free to change.
Classify each change by impact
With the list in hand, assign a class to each observable difference. Keep the reasoning next to the class so a reviewer can check it later.
Major. A consumer who upgrades must edit their own code, change a configuration value, or accept a behavior they did not choose. Removed exports, changed defaults that alter results, tightened validation, and new required inputs all belong here.
Minor. A consumer can upgrade without edits and receives something new. Added optional parameters, new exported helpers, additional response fields, and new event types are minor when the old calls still behave as before.
Patch. Behavior that was documented or agreed is restored or corrected, and no caller must change. A crash fix, a corrected calculation, and a documentation-matching sort order are patch changes.
| Change class | SemVer increment | Evidence to record | Reviewer |
|---|---|---|---|
| Removed export, renamed symbol | Major | Before and after import shape, list of known consumers | Library owner |
| Added optional input or output field | Minor | Proof old calls are unchanged, new field documented | Library owner |
| Corrected behavior to match documented contract | Patch | Doc or contract that defines correct behavior | Reviewer plus test owner |
| Tightened validation that rejects previously accepted input | Major | Example of input that now fails | API owner |
| Internal refactor with no observable difference | Patch or no release | Statement of what a consumer would observe | Reviewer |
| Reworded error text that consumers parse | Major | Consumer that reads the text | API owner |
The official specification is explicit that major, minor, and patch map to incompatible changes, backward-compatible additions, and compatible fixes respectively (F073). It also states that the classification depends on the declared public API and compatibility expectations, so the class you assign is only as good as the surface you declared (F073).
Choose major, minor, or patch
The increment is the largest class in your list. One breaking change makes the release major even if nine other changes are patches.
Resist two shortcuts. Do not derive the version from commit count or diff size, because neither measures consumer impact (F075). Do not hide a breaking change in a patch to spare users a major upgrade, because that converts a version number into a false promise. Consumers who pin a patch expect no edits, and a hidden break violates that expectation without warning.
Commit conventions can feed this process without deciding it. Conventional Commits defines a BREAKING CHANGE footer and an exclamation-mark notation to mark incompatible modifications, and it states that breaking changes correlate with a major version (Conventional Commits 1.0.0, official). Use the footer to carry the intent, then confirm the classification against observed consumer impact rather than trusting the label alone.
When the class is genuinely ambiguous, the tie goes to the consumer’s ability to rely on the old behavior. If a reasonable consumer could have depended on it, treat its removal as breaking.
Handle pre-release and build metadata
The specification supports pre-release identifiers such as 1.4.0-alpha.1 and build metadata appended after a plus sign. A pre-release label signals that the version is not the stable release of that series and that its behavior may still change.
Treat the label as a signal, not a universal stability promise. Different projects use pre-releases for different levels of risk, and the specification does not define how stable an alpha must be. Say in your own release notes what your pre-release labels mean, because the label alone will not tell a consumer whether to trust it in production.
Build metadata is ignored when determining version precedence. It is a place for a build number or commit reference, not a way to rescue a wrong increment. If you attached the wrong pre-release identifier, publish a new version rather than reusing the old one.
Keep released versions immutable
A released version must not be modified (F074). If a published release has a defect, the specification expects a new version rather than an edit to the existing tag or artifact (F074).
That rule has practical consequences for release mechanics. A tag is the usual pointer to a released version, and the Git documentation describes annotated tags as the form meant for releases (Git tag, official). The companion guide to tagging a tested commit is Claude Code release tags and annotated markers, which covers how to confirm the tag points at the reviewed commit.
Moving a published tag rewrites the identity of a version consumers may already depend on. Build systems that cache by tag, mirrors that copied the old object, and consumers that pinned the digest can all end up with a different code under the same name. The correction path is a new patch release that supersedes the broken one, plus a changelog entry that says what was wrong.
Immutability also applies to the record behind the decision. If you later reclassify a change, note the revision in the changelog instead of silently editing the old entry.
Ask Claude Code to challenge the classification
After you draft the increment, ask Claude Code to argue against it. A useful prompt names the declared surface and the proposed class, then requests objections:
Our declared public surface is the exported functions in
src/index.tsplus the documented REST routes. We propose a minor release. List every observable difference in the current diff that a consumer could detect, and for each one say whether it forces a consumer code change.
Review the response for the three failure modes this kind of check commonly shows. It can overclassify a safe change as breaking to avoid risk, which inflates major versions. It can miss consumers outside the repository, because the tool only sees the checked-out tree. It can also accept an undocumented behavior as non-public when a real integrator depends on it.
Treat the output as a list of objections to test, not as a verdict. The classification owner is still a person who knows which integrators exist. This is the same discipline described in Claude Code code review bottleneck: generated analysis widens coverage, and a human still owns the decision.
Record the version decision evidence
A version decision that nobody can reconstruct is a version decision that gets relitigated. Keep the evidence next to the release.
| Released version | Tag | Changelog entry | Migration note |
|---|---|---|---|
| 2.0.0 | v2.0.0 |
Removed parseConfig; use loadConfig |
Rename the import and update call sites |
| 2.1.0 | v2.1.0 |
Added optional strict flag to loadConfig |
None required; default behavior unchanged |
| 2.1.1 | v2.1.1 |
Fixed sort order of listRules to match documentation |
None required |
The version and tag identify the released code, the changelog entry states the consumer-visible difference, and the migration note tells a consumer what to do. Writing the migration note is also a forcing function: a breaking change with no migration note is usually a breaking change nobody fully understood.
Evidence recording is a review workflow, not a rule the specification imposes (F075). Some projects add extra versioning conventions on top of SemVer, and those conventions can be stricter. Keep a Changelog recommends grouping entries by Added, Changed, Deprecated, Removed, Fixed, and Security, which pairs naturally with the compatibility classes above (Keep a Changelog, official).
How to turn these entries into consumer-facing notes is covered in Claude Code changelog and consumer-facing changes, and the final gate before publishing is Claude Code release checklist and candidate verification.
Worked example: a configuration loader release
Suppose a small library exposes three exported functions: loadConfig(path), parseConfig(text), and validate(config). A change set does four things. It renames parseConfig to loadConfig and deletes the old name. It adds an optional strict argument to validate that defaults to false. It fixes a bug where loadConfig ignored a documented REGION default. It rewords an internal error string that no consumer parses.
Consumer-visible list: the rename is observable, the new optional argument is observable, the bug fix restores documented behavior, and the error string is not observable to any known consumer.
Classification: the rename forces every parseConfig caller to edit code, so the release is major. The optional argument is a compatible addition and the bug fix is a compatible correction, but neither lowers the largest class.
Increment: 2.0.0, because the current series is 1.9.3 and one breaking change dominates.
Records: the changelog entry under Removed names parseConfig and points to loadConfig. The migration note says to rename the import and update call sites. The tag v2.0.0 points at the reviewed commit.
Derived arithmetic for the migration surface: the repository search finds 14 call sites of parseConfig across 6 consumer files. After the rename, remaining old-name references = 14 - 14 = 0. A grep that still returns a nonzero count after the migration is evidence the migration is incomplete; it is not a compatibility measurement.
The concrete win is that a consumer reading 2.0.0 knows to budget migration time before upgrading, and a consumer reading 2.1.0 knows the upgrade should be a dependency bump. The concrete loss is that the whole classification rests on the declared surface. If parseConfig was actually called by an integrator your search could not see, the major release is still right, but if you had classified it as patch, that integrator would break without warning.
Practical checklist and runbook
Run this sequence before you tag. It takes minutes on a small change set and catches the classification errors that are expensive to correct after publication.
- Write the declared surface. List exports, routes, formats, and error contracts consumers can touch.
- Enumerate observable differences. Work from the diff against the tagged base, not from commit messages.
- Classify each difference. Assign breaking, compatible addition, or compatible fix with one line of reasoning.
- Choose the largest class. One breaking change makes the release major.
- Name the migration steps. A breaking change without steps is not ready.
- Confirm the pointer. Check the tag or release ref targets the reviewed commit before publishing artifacts.
- Challenge the call. Ask Claude Code to list consumer-observable differences and test its objections.
- Write the evidence row. Version, tag, changelog entry, migration note, reviewer.
- Publish once. If the release is wrong, issue a new version instead of editing the released one.
| Gate | Pass condition | Failure response |
|---|---|---|
| Surface declared | Consumer-touchable entries are listed | Stop and declare the surface first |
| Changes enumerated | Every observable difference has a row | Re-diff against the tagged base |
| Class justified | Each row has a reason a reviewer can check | Add the missing reasoning |
| Increment chosen | Matches the largest class, not diff size | Recompute from the classes |
| Migration written | Breaking changes name consumer steps | Write steps or downgrade the scope |
| Immutability | No published version will be edited | Plan a superseding release |
The practical implication is that version numbers work only when they are expensive to fake. A team that classifies from consumer impact, records the evidence, and refuses to edit released versions gives consumers a signal they can automate against.
Concrete win, honest loss, and next decision
Win: In the configuration-loader example, the rename forces a major release, and the published evidence row makes that decision checkable. A consumer can read the changelog, see the migration step, and plan the upgrade instead of discovering a broken import in production.
Loss: The classification inherits every weakness of the declared surface. A consumer depending on undocumented behavior, a generated client pinned to a response shape, or a mirror that treats any tag move as authoritative can all defeat a well-reasoned increment. The specification itself frames major, minor, and patch as a contract about compatibility, not a certificate of implementation quality (F073).
Implication: Use this classification discipline for anything with outside consumers: published libraries, public APIs, and internal packages that several teams import. For an application deployed as one unit with no public API, the same method still helps, but the version number carries less contractual weight and a lighter process is reasonable.
Connect the decision to the rest of the batch
A version decision is one step in a release chain. Annotated release tags pin the exact commit the version names, and consumer-facing changelog entries translate the classification into migration steps a consumer can follow.
When a fix must reach an older supported line, hotfix backports with cherry-pick shows how to carry the change without rewriting the released tag. Planning a revert before release covers the inverse path, and verifying the release candidate ties identity, tests, notes, and rollback into one record.
For the commits feeding the decision, atomic commits that stay revertible and commit messages that encode change intent make the observable differences easier to enumerate. Resolving merge conflicts by behavior matters when a long-lived branch finally merges.
Testing evidence backs the compatibility claim. Mapping changed code to checks keeps the relevant tests in scope, triaging flaky tests before rerunning prevents a false green from driving a release, and contract tests for API expectations is the consumer-driven check behind a compatibility claim.
When the increment depends on a bug fix, hunting the regression with git bisect locates the commit that changed behavior. Guardrails against rewriting history are in destructive git reset guardrails, and choosing a rebase or merge policy explains when history should stay as published.
Broader quality gates appear in inspecting the snapshot diff rather than trusting green, static analysis baselined to reduce noise, and proving usage before removing dead code. Merge mechanics are in recovering failed merge-queue groups and defining branch protection merge checks.
When a version decision must move to another maintainer, session handoff with team context preserves the reasoning. For the limits of a green pipeline, see false success from passing tests, and for closing the loop after a change, see verification as done proof.
Data gap and future update
The specification defines major, minor, and patch in terms of compatibility, and the cited Git and changelog pages describe the mechanics of tags and entries. Neither source provides a measured rate of misclassification, a benchmark for evidence recording, or a comparison of classification methods. No such number is claimed in this article.
Pre-release label semantics are the weakest area. The specification defines the syntax and precedence but not how stable a pre-release must be, so the meaning stays project-specific. A future update should add concrete project policies for pre-release labels if the maintainers publish them.
Rolling documentation can change. Recheck the cited pages before relying on a specific wording, and keep the caveats if the text shifts. Until a measured study exists, treat this method as a reviewable workflow rather than a proven reduction in compatibility incidents.
One AI API Key option for OpenAI-format agents
Claude Code uses an Anthropic-format route, so the One AI free model IDs are not a Claude Code model source. The packet records Claude IDs as unavailable on 2026-11-27.
For a separate OpenAI-format agent, One AI API Key provides https://api.oneaiapikey.com/v1, one key, and 46 live free IDs. That option concerns a different client and request format, not a workaround for Claude Code authentication. Check the free model list and eligibility details before choosing an agent route.
FAQ
Does an internal refactor ever require a major release?
Only if a consumer can observe a difference. If no export, route, format, error contract, or documented behavior changes, the refactor is a patch candidate or needs no release at all. Classify from the observable difference, not from the size of the internal work (F073).
Can a deprecation ship in a minor release?
A warning can usually ship as minor or patch because the old behavior still works. Removing the deprecated path is what forces the major. Make the timeline explicit in the changelog so consumers can plan the migration.
Is SemVer a guarantee that the release is bug-free?
No. The specification describes versioning by compatibility class (F073). A patch can still contain a defect, and a major can be otherwise clean. Testing and review own correctness; the version number owns the compatibility promise.
Can tooling decide the increment automatically?
Tooling can propose an increment from commit labels or API diffs, and that proposal is a useful starting point. Confirm it against observed consumer impact, because a label can be wrong and a diff can miss undocumented dependencies (F075). Keep a person as the classification owner.
What if I already published the wrong increment?
Issue a new version with the correct classification and explain the correction in the changelog (F074). Do not edit the released tag or artifact, because consumers may already depend on the published identity.
More Claude Code troubleshooting
- Claude Code Deterministic Tests: Control Time and Randomness
- Claude Code Property Tests: Generate Edge Cases
- Claude Code Mutation Testing: Find Weak Assertions
- Claude Code Test Fixtures: Isolate Shared State
- Claude Code Minimal Repro: Shrink the Failure
- Claude Code Debug Log: Separate Facts from Hypotheses
- Claude Code Async Races: Make Scheduling Deterministic
- Claude Code Memory Leaks: Compare Allocation Snapshots
- Claude Code Complexity: Refactor Hotspots, Not Metrics
- Claude Code Duplication: Choose Reuse or Independence
- Claude Code Git Stash: Recover Work Without Dropping It
Sources
- Official: Semantic Versioning 2.0.0, supporting the major, minor, and patch definitions, the immutability of released versions, and the dependence on a declared public API (F073, F074).
- Official: Pact documentation, supporting consumer-driven contracts as explicit agreements about messages between consumer and provider.
- Official: Keep a Changelog, supporting categorized changelog entries that pair with compatibility classes.
- Official: Git tag, supporting annotated tags as the form meant for releases (F076 context).
- Official: Claude Code best practices, supporting the review workflow of challenging a proposed classification.
- Official: Conventional Commits 1.0.0, supporting the breaking-change notation that correlates with a major increment.