rust-dependencies
Skill0 starsChanged 35 days agoMITView on GitHub
Use when managing Rust dependencies, versions, and semver.
- Installs packages
1 other project uses a version of this.
Adopted by
Most recently taken up by
- full-stack-skills/rust-skillstheir own version, first seen Oct 15, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- full-stack-skills/rust-skills★ 8same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository15 other files it gives its agents.
- AGENTS.mdAGENTS.md
- rustoriaSkill
- rust-debuggingSkill
- rust-fundamentalsSkill
- rust-axumSkill
- rust-clapSkill
- rust-dieselSkill
- rust-ratatuiSkill
- rust-rayonSkill
- rust-serdeSkill
- rust-tokioSkill
- rust-productionSkill
- rust-code-auditSkill
- rust-stdSkill
- rust-unsafe-checkerSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 116
If you publish a library, verify your stated lower bounds actually compile — otherwise you may claim serde = "1" while secretly requiring …
- Very specific: line 152
Dependency sources: Prefer registry dependencies.
- Very specific: line 162
Reproducibility: Commit Cargo.lock for binaries.
- Distinctive: line 208
Test minimal versions: before publishing a library.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Rust Dependencies and SemVer
Managing crates, version requirements, and the lockfile. (This skill is about Cargo dependency/version management, not git.)
Declaring Dependencies (Cargo.toml)
[dependencies]
# Caret (the default) — see the caret table below
serde = "1.0.219" # >=1.0.219, <2.0.0
serde = "1.0" # >=1.0.0, <2.0.0
serde = "1" # >=1.0.0, <2.0.0
# Exact version
serde = "=1.0.219"
# Tilde — no major/minor bumps
serde = "~1.0.3" # >=1.0.3, <1.1.0
serde = "~1.0" # >=1.0.0, <1.1.0
# Wildcard
serde = "1.*" # >=1.0.0, <2.0.0
serde = "*" # any version (not recommended)
# Comparison requirements
serde = ">=1.0.200, <2.0"
# Git dependency
serde = { git = "https://github.com/serde-rs/serde" }
# Path dependency
serde = { path = "../serde" }
# Features
serde = { version = "1.0", features = ["derive"] }
# Optional dependency
serde = { version = "1.0", optional = true }
# Renaming
serde1 = { package = "serde", version = "1.0" }SemVer and Caret Requirements
SemVer: major = breaking changes, minor = backward-compatible features, patch = backward-compatible fixes. Cargo's caret requirements encode how "compatible" is interpreted — and the 0.x rule is the part people get wrong:
| Requirement | Allows | Why |
^1.2.3 (= "1.2.3") | >=1.2.3, <2.0.0 | Minor/patch bumps are compatible |
^0.2.3 (= "0.2.3") | >=0.2.3, <0.3.0 | For 0.x, the left-most non-zero digit is the compatibility boundary — a minor bump (0.2 → 0.3) may break |
^0.0.3 (= "0.0.3") | =0.0.3 exactly | With 0.0.x, even the patch release may break |
So anyhow = "1" floats across all 1.x, but ratatui = "0.30" will NOT auto-upgrade to 0.31 — you must bump 0.x
minors deliberately and read the changelog.
Which bump to make when publishing: fixes only → patch; new backward-compatible API → minor; any breaking change → major (or the left-most non-zero digit, pre-1.0).
Cargo.lock
Version requirements in Cargo.toml are ranges, not pins — they never pin transitive dependencies. Cargo.lock
records the exact resolved version of every crate in the graph, direct and transitive.
# (Re)generate Cargo.lock from scratch without building
cargo generate-lockfile
# Update all dependencies, respecting Cargo.toml requirements
cargo update
# Update one crate (and what depends on it)
cargo update -p serde
# Update one crate to a specific version
cargo update -p serde --precise 1.0.219
# Check for outdated direct dependencies
cargo install cargo-outdated
cargo outdatedShould you commit Cargo.lock? The old advice — binaries yes, libraries no — is outdated. Modern practice:
commit it for binaries AND libraries. cargo publish ignores the lockfile, so committing it never constrains your
library's dependents; what it buys you is reproducible CI and bisectable history. The trade-off: without a committed
lockfile, CI always tests against the latest compatible deps, which catches upstream breakage early. Many projects
commit the lockfile and add a scheduled CI job that runs cargo update first to get both.
MSRV-Aware Resolution (Rust 1.84+)
Declare your minimum supported Rust version, then make the resolver prefer dependency versions compatible with it:
# Cargo.toml (per package)
[package]
rust-version = "1.85"# .cargo/config.toml
[resolver]
incompatible-rust-versions = "fallback"With fallback, when several versions of a dependency satisfy your requirement, Cargo picks one that works with your
rust-version instead of blindly picking the newest.
Minimal-Versions Testing
If you publish a library, verify your stated lower bounds actually compile — otherwise you may claim serde = "1"
while secretly requiring 1.0.190:
# Nightly-only as of late 2026
cargo +nightly update -Z minimal-versions
cargo +nightly test
cargo +nightly update # restore the normal lockfile afterwardsInspecting and Auditing
# View dependency tree
cargo tree
# View with features
cargo tree -e features
# Check for duplicate versions of the same crate
cargo tree -d
# Security advisories (RUSTSEC)
cargo install cargo-audit
cargo auditFor CI gating beyond vulnerabilities - license policy, banned/duplicate crates, source allow-lists - use
cargo-deny (cargo deny check). See the production/security tooling for policy setup.
Supply-Chain Considerations
What to reason about beyond cargo audit:
- Yanked versions. A yanked release stays resolvable if already in
Cargo.lockbut cannot be newly selected.cargo updatemay move you off (or onto) yanked versions; treat unexpected lockfile churn as reviewable. - Dependency sources. Prefer registry dependencies. Git dependencies pin a
rev(never track a moving branch in released code); path dependencies must not survive into published crates (cargo packagerejects them). - Build-dependencies and proc-macros execute at compile time on your machine and in CI - they are code execution
trust decisions, not just library choices. Review
[build-dependencies]and derive-heavy trees accordingly. - Feature activation. Optional dependencies turn on with a feature elsewhere in the graph;
cargo tree -e featuresshows who activated what. Unexpected activation can pull in heavier or riskier transitive trees. - Transitive depth. Direct dependencies are reviewed; transitive ones are where surprises live.
cargo tree -dfor duplicates, and check who pulls in unmaintained crates (cargo deny check banssurfaces this). - Source replacement (
.cargo/config.toml[source]replacement, vendoring) changes where code comes from - legitimate for reproducibility/offline builds, but it must itself be reviewed and pinned. - Reproducibility. Commit
Cargo.lockfor binaries;cargo install --lockedin CI images; considercargo vendorplus a checksum-verified vendor directory for hermetic builds.
Workspace Management
# Cargo.toml (workspace root)
[workspace]
members = [
"crates/*",
]
[workspace.dependencies]
serde = "1.0"
tokio = { version = "1", features = ["full"] }# crates/my-crate/Cargo.toml
[dependencies]
serde = { workspace = true }Publishing Crates
# 1. Bump version in Cargo.toml, update CHANGELOG.md
# 2. Inspect what will be packaged
cargo package --list
# 3. Dry-run the publish
cargo publish --dry-run
# 4. Publish
cargo publish
# 5. Verify
cargo search my-crateBest Practices
- Use caret requirements (
"1.0") for normal dependencies; pin exact (=1.0.219) only for known-bad ranges or reproducible tooling. - Commit Cargo.lock for binaries, and prefer committing it for libraries too (reproducible CI;
cargo publishignores it) — keep a scheduledcargo updateCI job to stay current. - Bump 0.x minors deliberately —
^0.2.3won't float to 0.3; read changelogs before bumping. - Declare
rust-versionand enable MSRV-aware resolution (Rust 1.84+). - Audit in CI —
cargo auditfor RUSTSEC advisories,cargo denyfor advisories + licenses + bans. - Test minimal versions before publishing a library.
- Use workspaces with
workspace.dependenciesfor multi-crate projects.
When to Use
- Adding or updating dependencies
- Resolving version conflicts
- Publishing crates
- Managing workspaces
- Security auditing
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

