/rust-skills:rust-semverfrom rust-skills
Determines breaking changes in Rust crates using cargo-semver-checks (270+ lints), manages pre-1.0 semver rules, workspace lockstep publishing, yank/deprecate workflows, and RustSec advisories.
Ships in rust-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Authority: Cargo Semver Reference, RFC 1105 (Semver), cargo-semver-checks, RustSec Advisory Database.
This skill owns what is and isn't a breaking change in Rust, the publishing workflow for crates.io, and workspace-wide release coordination. It does not own API design (rust-api-design), Cargo manifest mechanics (rust-cargo-build), or lint config (rust-style-clippy).
0.x.y) special rulescargo-semver-checks (270+ lints)cargo-workspaces#[non_exhaustive], sealed traits, feature flags, hidden modulesrust-api-designcargo publish basics — see rust-cargo-buildrust-api-designrust-cargo-buildrust-style-clippyrust-testingThis skill does not collect, store, or transmit user data. Publishing to crates.io is a public action — confirm with the user before running cargo publish.
Semver applies to public API surface. In Rust, the public API is everything visible to downstream — but the definition is subtle.
// src/lib.rs
pub fn hello() {} // public API
pub struct User { pub name: String } // public API
pub mod network { // public API
pub fn connect() {} // public API
}
mod internal { // private — NOT public API
pub fn helper() {} // pub, but module is private → not reachable
}
Rule: an item is public API if and only if a downstream crate can name it without unsafe. A pub item inside a pub(crate) module is not public API.
// src/lib.rs
mod hidden;
pub use hidden::Config; // Config IS public API (reachable via crate root)
Even though hidden is private, Config is reachable via the re-export — it's public API.
#[doc(hidden)]
pub mod unstable { /* */ }
#[doc(hidden)] does NOT remove items from the public API for semver purposes. Downstream can still use crate::unstable::Foo. If you intend them to be unstable, gate behind a feature flag or move to a private module.
#[cfg(feature = "json")]
pub mod json; // public API only when feature enabled
The semver contract is per feature combination. Adding items under json is a minor bump for users with json enabled, and invisible to users without.
The Cargo Book lists the canonical changes. Summary:
| Change | Why |
|---|---|
| Remove a public item | Downstream code referencing it breaks |
| Rename a public item | Same as remove + add |
| Change a function signature (param/return type) | Callers fail to compile |
Add a new variant to a non-#[non_exhaustive] enum | match lacks wildcard |
| Add a field to a public struct literal | Foo { x: 1 } breaks if Foo gains a field |
| Implement a trait for an external type (or vice versa) | Conflicts with downstream orphan impls |
| Tighten trait bounds | Downstream impls may no longer satisfy |
Change pub item to pub(crate) | Removes from API |
Remove Copy/Clone/Debug derive | Downstream may rely on them |
| Change semver of a public dependency | May transitively break |
| Change | Why |
|---|---|
| Add a new public function | Additive |
| Add a new trait impl for your own type | Additive |
Add a variant to a #[non_exhaustive] enum | Caller has wildcard |
| Add a field to a private-field struct | Caller can't struct-literal it |
| Add a new feature flag | Invisible to non-users |
| Loosen trait bounds | More permissive |
| Add default method to a sealed trait | Sealed = you control impls |
Deprecate with #[deprecated] | Soft removal |
// Before
pub trait Foo { fn a(&self); }
// After
pub trait Foo { fn a(&self); fn b(&self); } // ❌ BREAKING
Downstream impls of Foo will fail to compile (missing b). Fix: either (a) bump major, (b) seal the trait before adding methods, or (c) add b as a default method (fn b(&self) {}).
pub trait Foo { fn a(&self); fn b(&self) {} } // ✅ non-breaking
Default methods are non-breaking. But you cannot later remove the default without breaking.
// Before
pub fn parse<T>(input: &str) -> T { /* */ }
// After
pub fn parse<T = String>(input: &str) -> T { /* */ } // ✅ non-breaking
Adding a default to a generic is non-breaking. Removing the default IS breaking.
If Foo is currently object-safe (Box<dyn Foo> works), making it object-unsafe (adding Self: Sized bound, adding generic method) is breaking.
// Before
pub fn parse(input: &str) -> &str { /* */ }
// After
pub fn parse<'a>(input: &'a str) -> &'a str { /* */ } // ✅ usually non-breaking
Lifetime elision makes most lifetime changes transparent.
0.x.y) RulesCrates at version 0.x follow modified semver:
| Version | Compatible with | What increments on breaking |
|---|---|---|
0.0.x | Nothing — experimental, any change OK | 0.0.x |
0.x.y where x > 0 | Same 0.x.* only | The minor (x) position = "major" |
So 0.1.0 → 0.2.0 is a major bump. 0.1.0 → 0.1.1 is a patch (bug fix).
# Allowed in Cargo.toml:
[dependencies]
my-crate = "0.1" # means >=0.1.0, <0.2.0
Once you hit 1.0.0, normal semver resumes.
Don't fear 1.0. Many crates live too long at 0.x because they're afraid of the commitment. The cost of 1.0 is "I commit to breaking changes requiring major bumps," which is usually fine.
cargo-semver-checkscargo-semver-checks is a tool that compares your crate's current public API against a published version and flags breaking changes. 270+ lints cover most cases.
cargo install cargo-semver-checks --locked
# Before publishing a new version:
cargo semver-checks check-release
# Compare against a specific baseline:
cargo semver-checks check-release --baseline-version 1.2.0
# Compare against a git tag:
cargo semver-checks check-release --baseline-tag v1.2.0
--- failure function_missing ---
Description: Function removed or renamed, or return type changed.
Error: the function `parse` was removed from the API
Each failure is a semver violation. Fix by either:
# .github/workflows/semver.yml
name: Semver Check
on: [pull_request]
jobs:
semver:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: obi1kenobi/cargo-semver-checks-action@v2
PRs that introduce breaking changes will fail CI unless the version is bumped accordingly.
| Lint | Meaning | Fix |
|---|---|---|
function_missing | Removed or renamed function | Restore or bump major |
enum_variant_added | Added variant to non-#[non_exhaustive] enum | Mark #[non_exhaustive] |
struct_field_added | Added field to public struct | Make private or #[non_exhaustive] |
trait_method_added | Added method to unsealed trait | Add default or seal |
inherent_method_missing | Removed impl block method | Restore or bump major |
type_marked_deprecated | #[deprecated] added | Acceptable, bump minor |
# 1. Bump version in Cargo.toml
# 2. Update CHANGELOG.md
# 3. Run quality gates
cargo fmt --all --check
cargo test --workspace --all-targets --all-features
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo semver-checks check-release
# 4. Verify package contents
cargo package --list # show files included
cargo package # build the .crate in target/package/
cargo publish --dry-run # full simulation
# 5. Publish
cargo publish # 🚨 public action — confirm with user first
cargo-workspacesFor multi-crate workspaces, cargo-workspaces automates the version bump + publish dance:
cargo install cargo-workspaces
# Bump all members together:
cargo workspaces version minor # 0.1.0 → 0.2.0 across all members
# Bump with custom prerelease:
cargo workspaces version prerelease --pre-id beta
# Publish all members in topological order:
cargo workspaces publish
cargo-workspaces:
Cargo.toml versionpath = "" dependencies to the new version--no-individual-tags or --individual-tagsIf a version has a critical bug, yank it (prevents new dependencies on it, doesn't remove existing):
cargo yank --vers 1.2.3
# To undo:
cargo yank --vers 1.2.3 --undo
Yanked versions remain in the registry for projects with Cargo.lock pinning them.
Mark the crate as deprecated on crates.io via the maintainer's page. Downstream will see a deprecation notice when they run cargo add.
RustSec Advisory Database tracks known vulnerabilities in published crates.
cargo-auditcargo install cargo-audit --locked
cargo audit # scan Cargo.lock against advisory DB
cargo audit --deny warnings # fail CI on any advisory
cargo-deny (more comprehensive)cargo-deny covers:
# deny.toml
[advisories]
db-urls = ["https://github.com/rustsec/advisory-db"]
yanked = "deny"
[licenses]
allow = ["MIT", "Apache-2.0", "BSD-3-Clause"]
confidence-threshold = 0.8
cargo install cargo-deny --locked
cargo deny check
For every publish, write a CHANGELOG.md entry. Suggested format:
## [1.2.0] - 2026-07-21
### Added
- `Client::builder()` for ergonomic construction (#45)
- `Visibility::IncludeHidden` variant
### Changed
- `parse()` now accepts `impl AsRef<str>` instead of `&str`
### Deprecated
- `Client::new()` — use `Client::builder()` instead
### Fixed
- Panic on empty input in `parse()` — now returns `Err`
Tools:
cargo-release — automates version bump + tag + publishrelease-plz — generates CHANGELOG from conventional commitspub items since the last release?cargo publish) or workspace (cargo workspaces publish)| Change | Bump | Notes |
|---|---|---|
Added a pub fn | minor | Additive |
| Fixed a bug | patch | Behavior change, no API change |
Removed a pub fn | major | Or restore + deprecate |
| Added a sealed trait method | minor | Sealed = you control impls |
| Added an unsealed trait method | major | Or add default |
| Added enum variant | major (or minor if #[non_exhaustive]) | |
| Added pub struct field | major (or minor if #[non_exhaustive] or private) | |
| Bumped MSRV | minor (if min = 1.0+) | Document policy |
| Bumped dependency semver-major | major | Transitive break |
cargo-workspaces recipesexamples/golden-semver/ — a crate demonstrating a non-breaking version bumpagents/openai.yaml (opens in a new tab)examples/golden-semver/Cargo.lock (opens in a new tab)examples/golden-semver/Cargo.toml (opens in a new tab)examples/golden-semver/src/lib.rs (opens in a new tab)examples/workspace-publishing.md (opens in a new tab)references/cargo-semver-checks-lints.md (opens in a new tab)references/semver-reference.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
29 skills in this plugin
/rust-api-designDesign Rust library APIs that follow the Rust API Guidelines — naming (C-CASE, C-CONV, C-GETTER), interop traits (C-COMMON-TRAITS, C-CONVERT, C-ITER, C-SERDE), predictability (C-INTUITIVE, C-CONST), flexibility (C-GENERIC, C-NEWTYPE, C-EXT), type safety (C-BOOL, C-NONZERO, C-WRAPPER, C-STR), dependability (C-PANIC, C-UNWRAP), debuggability (C-DEBUG), and future-proofing (C-SEALED, C-STRUCT-FIELD, C-NON-EXHAUSTIVE). Use when users design a public crate API, choose between generics/concrete/newtype, decide trait bounds, hide implementation, avoid breakage, or ask "what is idiomatic Rust API design"; hand semver and publish workflow to rust-semver, lint config to rust-style-clippy, and in-crate layout to rust-module-layout./rust-by-exampleShow Rust patterns through short compilable examples — type conversions (From/Into/TryFrom/as/Deref), flow control (if let/while let/match/loop), functions and closures (Fn/FnMut/FnOnce, captures), modules (mod/use/pub/super/self), generics and traits (bounds/associated types/trait objects), error handling (?/Result/thiserror/anyhow), attributes (derive/cfg/inline/allow), unsafe (raw pointers/unions/ABI), procedural macros (derive/attribute/function-like), and inline asm. Use when users ask "how do I write X in Rust", need a concrete pattern with copy-pasteable code, or are migrating from Java/Python/Go/C++ and want the Rust equivalent; hand architecture decisions to rust-api-design/rust-workspace, std API selection to rust-stdlib, and async runtime to rust-concurrency.Generated from the plugin's indexed repository (full-stack-skills/rust-skills) — no native marketplace selected
npx claudepluginhub p/full-stack-skills-rust-skillsOther plugins' skills for the same job