On this page
What Is Semantic Versioning (SemVer)?
Semantic versioning is the MAJOR.MINOR.PATCH scheme that tells consumers what a version change means. Learn how to read and apply it.
Quick answer
- Semantic versioning is a
MAJOR.MINOR.PATCHscheme where each segment signals the size of the change.- MAJOR breaks compatibility, MINOR adds features compatibly, PATCH fixes bugs compatibly.
- It lets consumers pin dependencies and know, from the number alone, whether an upgrade is safe.
What is SemVer?
Semantic versioning is a version-numbering convention, specified at semver.org, that encodes meaning in the version string. A version like 2.4.1 reads as: major 2, minor 4, patch 1. The rules define what each segment means — bump MAJOR for incompatible API changes, MINOR for backward-compatible features, PATCH for backward-compatible bug fixes. Pre-release and build metadata can be appended, as in 2.4.1-rc.1.
Why it matters
Before SemVer, version numbers were arbitrary, so a “minor” update could break everything. SemVer makes compatibility legible: if you depend on 2.x and a 3.0.0 arrives, you know to check for breaking changes before upgrading. It’s the foundation that package managers, CI/CD, and dependency pinning all rely on.
How to apply it
When you ship: a bug fix that doesn’t change behavior bumps PATCH; a new feature that doesn’t break existing callers bumps MINOR; any change that could break a consumer bumps MAJOR. The discipline is honesty about compatibility — the number is a promise to whoever depends on you.
Where this bites vibecoders
The practical pain point is dependencies: pinning
latestinstead of a semver range means a breaking change arrives silently, which is also the entry point for supply chain attacks. And for your own releases, an AI assistant that always ships1.0.0gives your users no compatibility signal. Read semver as a contract, and pin your dependencies to known-good ranges.
Where AI coding assistants get this wrong
- Pinning
latestor wildcard versions, defeating reproducibility. - Bumping versions arbitrarily with no regard for compatibility.
- Generating version strings that don’t follow the spec (leading zeros, odd suffixes).
- Treating a version bump as a label rather than a compatibility promise.
Checklist
- Follow MAJOR.MINOR.PATCH, with the spec’s rules for each bump.
- Bump MAJOR only on breaking changes.
- Pin dependencies to semver ranges, never
latest. - Document breaking changes when you bump MAJOR.
- Keep versions consistent across your releases.
FAQ
What does the caret in ^2.4.1 mean?
In npm-style semver ranges, ^2.4.1 allows updates to any compatible version: >=2.4.1 <3.0.0. The tilde ~2.4.1 allows only patch updates within the minor. These ranges let you get fixes without unexpected breaking changes.
What is a breaking change?
A change that existing consumers would need to adjust to — removing a function, changing a signature, altering behavior they rely on. If an upgrade could break someone, it’s a MAJOR bump under SemVer.
Is SemVer required?
No, but it’s the de facto standard for libraries and is assumed by most package managers and tooling. Following it is a courtesy to your users and a prerequisite for safe automated upgrades.