rust-cargo-mastery
Skill4 starsChanged 3 months agoApache-2.0View on GitHub
Master Cargo, the Rust package manager. Use when managing dependencies, configuring builds, setting up workspaces, publishing crates, using features for conditional compilation, or optimizing build times.
Files
Rust Cargo Mastery
Comprehensive guide to Cargo based on The Cargo Book.
When to Use This Skill
- Setting up new Rust projects
- Managing dependencies from crates.io
- Configuring build profiles and features
- Working with Cargo workspaces
- Publishing crates to crates.io
- Optimizing build times
- Understanding Cargo's resolution algorithm
Core References
- The Cargo Book - Full Cargo documentation
- Cargo Manifest - Cargo.toml reference
Dependencies
Specifying Dependencies
[dependencies]
serde = "1.0" # Exact or semver range
regex = "1.5" # Minor version compatible
anyhow = "1.0" # Any 1.x version
rand = { version = "0.8", features = ["small_rng"] }
[dev-dependencies]
criterion = "0.5"Version Syntax
| Syntax | Meaning |
| "1.0" | >=1.0.0, <2.0.0 |
| "=1.0.0" | Exact version |
| "^1.0" | >=1.0.0, <2.0.0 |
| "~1.0" | >=1.0.0, <1.1.0 |
External Dependencies
[dependencies]
log = "0.4"
env_logger = { path = "../env_logger" }
my_crate = { git = "https://github.com/user/repo" }Workspaces
Basic Workspace
# Cargo.toml (workspace root)
[workspace]
members = ["crate_a", "crate_b"]
resolver = "2"
[workspace.package]
version = "1.0.0"
edition = "2021"
[workspace.dependencies]
serde = "1.0"# crate_a/Cargo.toml
[package]
name = "crate_a"
version.workspace = true
edition.workspace = true
[dependencies]
serde = { workspace = true }Workspace Features
[workspace]
members = ["lib", "binary"]
[workspace.dependencies]
my_lib = { path = "lib", default-features = false }Features
Defining Features
[features]
default = ["std"]
std = []
derive = ["serde/derive"]
experimental = []Feature Unification
Workspace dependencies use unified features:
[dependencies]
common = { path = "../common", features = ["derive"] }
# Uses common's "derive" feature automaticallyConditional Compilation
#[cfg(feature = "experimental")]
fn experimental_api() {}
#[cfg(not(feature = "std"))]
fn no_std_compatible() {}Build Profiles
Custom Profiles
[profile.dev]
opt-level = 0
debug = true
split-debuginfo = "unpacked"
[profile.release]
opt-level = 3
lto = "thin"
codegen-units = 1
[profile.bench]
inherits = "release"Profile Override
[profile.dev.package."*"]
opt-level = 2Publishing
Publishing to crates.io
cargo login
cargo publishPackage Metadata
[package]
name = "my_crate"
version = "1.0.0"
edition = "2021"
description = "A short description"
license = "MIT"
license-file = "LICENSE"
repository = "https://github.com/user/repo"
documentation = "https://docs.rs/my_crate/"
homepage = "https://mycrate.io"
keywords = ["tag1", "tag2"]
categories = ["category1", "category2"]
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]Reference Map
references/dependencies.md- Dependency specification, versionsreferences/workspaces.md- Workspace configurationreferences/features.md- Feature flags, conditional compilationreferences/profiles.md- Build profiles, optimizationreferences/publishing.md- Publishing to crates.io
Common Commands
cargo new project_name
cargo build
cargo run
cargo test
cargo check
cargo doc
cargo publish
cargo update
cargo tree
cargo clippyKey References
In this repository80 other files it gives its agents.
- a11y-accessibility-designSkill
- agentic-ui-patternsSkill
- ai-native-ui-designSkill
- ai-ui-anti-patternsSkill
- ai-ui-heuristicsSkill
- calm-technology-uiSkill
- conversion-growth-designSkill
- cross-platform-designSkill
- dark-mode-designSkill
- data-visualizationSkill
- design-systemsSkill
- design-thinking-processSkill
- error-empty-statesSkill
- ethical-design-patternsSkill
- form-uxSkill
- information-architectureSkill
- interaction-design-patternsSkill
- internationalization-uiSkill
- mobile-touch-designSkill
- modal-classes-lifecycleSkill
- modal-container-imagesSkill
- modal-dicts-queuesSkill
- modal-endpointsSkill
- modal-fundamentalsSkill
- modal-gpu-computeSkill
- modal-networkingSkill
- modal-observabilitySkill
- modal-parallel-executionSkill
- modal-sandboxesSkill
- modal-scaling-performanceSkill
- modal-schedulingSkill
- modal-secretsSkill
- modal-serversSkill
- modal-storageSkill
- modal-web-servingSkill
- modal-workspace-adminSkill
- motion-design-principlesSkill
- notifications-permissionsSkill
- onboarding-uxSkill
- rust-api-designSkill
- rust-async-programmingSkill
- rust-cli-applicationsSkill
- rust-clippy-lintsSkill
- rust-closures-iteratorsSkill
- rust-compiler-internalsSkill
- rust-concurrencySkill
- rust-design-patternsSkill
- rust-editionsSkill
- rust-embeddedSkill
- rust-error-handlingSkill
- rust-game-developmentSkill
- rust-lifetimes-borrowingSkill
- rust-macrosSkill
- rust-performanceSkill
- rust-rustdocSkill
- rust-rustup-toolchainSkill
- rust-smart-pointersSkill
- rust-testing-benchmarkingSkill
- rust-type-systemSkill
- rust-unsafe-ffiSkill
- The first 60 shown.
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.

