rust-ecosystem
Skill1 starsChanged 6 months agoMITView on GitHub
Rust ecosystem — crate selection, Cargo features, workspaces, and tooling. Use this skill when: - User asks "which crate should I use for X?" - User works with Cargo workspaces or multi-crate projects - User asks about feature flags, optional dependencies, or cfg attributes - User asks about Cargo.lock, semver, or dependency management - User sets up CI for a Rust project - User asks about cargo plugins (cargo-audit, cargo-deny, cargo-expand, etc.) - User publishes a crate to crates.io - User asks about linking to C libraries (bindgen, cc crate) - User asks about proc macros or derive macros Trigger when the question is about crates, tooling, or project configuration.
- Reads credentials
- Installs packages
2 other projects use a version of this.
Adopted by
Most recently taken up by
- JSBtechnologies/rustkbtheir own version, first seen Oct 11, 2026
- huiali/rust-skillstheir own version, first seen Feb 9, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- huiali/rust-skills★ 47same name
- JSBtechnologies/rustkb★ 0same 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 repository24 other files it gives its agents.
- rust-api-designSkill
- rust-asyncSkill
- rust-axumSkill
- rust-cliSkill
- rust-cloud-nativeSkill
- rust-concurrencySkill
- rust-databaseSkill
- rust-dioxusSkill
- rust-embeddedSkill
- rust-error-handlingSkill
- rust-fintechSkill
- rust-masterySkill
- rust-memory-optimizationSkill
- rust-mlSkill
- rust-networkingSkill
- rust-observabilitySkill
- rust-ownershipSkill
- rust-design-patternsSkill
- rust-performanceSkill
- rust-securitySkill
- rust-testingSkill
- rust-type-systemSkill
- rust-unsafeSkill
- rust-wasmSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 415
Run cargo tree -d before adding crates that may duplicate versions.
- Very specific: line 416
Run cargo publish --dry-run and inspect cargo package --list.
- Distinctive: line 417
Use workspace-level dependencies for shared versions.
- Distinctive: line 418
Keep clippy, fmt, test, audit, and docs checks in CI.
≈ “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
Quick Navigation
- references/cargo_config.md
- references/clippy_lints.md
Rust Ecosystem
The essential crates, tools, and patterns for productive Rust development.
Crate Selection Guide
Serialization
| Need | Crate |
| JSON / YAML / TOML (derive) | serde + format crate |
| JSON | serde_json |
| TOML | toml |
| YAML | serde_yaml |
| MessagePack (binary) | rmp-serde |
| Protocol Buffers | prost |
| Fast binary | bincode, bitcode |
HTTP & Networking
| Need | Crate |
| HTTP client (async) | reqwest |
| HTTP client (sync) | ureq |
| Web framework | axum, actix-web |
| Low-level HTTP | hyper |
| gRPC | tonic |
| WebSocket | tokio-tungstenite |
Async
| Need | Crate |
| Async runtime | tokio (full), smol (light) |
| Async traits | async-trait |
| Streams | futures, tokio-stream |
| Async utilities | futures-util |
Databases
| Need | Crate |
| PostgreSQL / MySQL / SQLite (async) | sqlx |
| ORM | diesel |
| Redis | redis |
| MongoDB | mongodb |
| SQLite (sync) | rusqlite |
Error Handling
| Need | Crate |
| Library errors | thiserror |
| Application errors | anyhow |
| Fancy error output | miette |
CLI
| Need | Crate |
| Argument parsing | clap (derive) |
| Progress bars | indicatif |
| Terminal color | colored, nu-ansi-term |
| TUI | ratatui + crossterm |
| Terminal detect | atty, is-terminal |
Data & Algorithms
| Need | Crate |
| Faster HashMap | rustc-hash, ahash |
| SmallVec | smallvec, tinyvec |
| Concurrent data structures | dashmap, crossbeam |
| UUID | uuid |
| Dates/times | chrono, time |
| Regular expressions | regex |
| Random numbers | rand |
Observability
| Need | Crate |
| Structured logging | tracing |
| Log facade | log |
| tracing subscriber | tracing-subscriber |
| OpenTelemetry | opentelemetry, tracing-opentelemetry |
Cargo Workspaces
For multi-crate projects, use workspaces to share dependencies and build settings:
# workspace Cargo.toml
[workspace]
members = ["crates/core", "crates/api", "crates/cli", "crates/worker"]
resolver = "2" # Use this
# Share dependency versions across workspace
[workspace.dependencies]
tokio = { version = "1", features = ["full"] }
serde = { version = "1", features = ["derive"] }
anyhow = "1"
tracing = "0.1"
sqlx = { version = "0.8", features = ["postgres", "runtime-tokio-rustls"] }# crates/api/Cargo.toml
[dependencies]
# Inherit version from workspace
tokio.workspace = true
serde.workspace = true
# Override features if needed
serde = { workspace = true, features = ["derive", "rc"] }
# Crate-specific dep
axum = "0.8"# Workspace lint configuration
[workspace.lints.rust]
unsafe_code = "forbid"
[workspace.lints.clippy]
all = { level = "warn", priority = -1 }
pedantic = { level = "warn", priority = -1 }
# Specific overrides
module_name_repetitions = "allow"Feature Flags
[features]
default = ["std"]
std = []
async = ["dep:tokio", "dep:futures"]
full = ["async", "tls"]
tls = ["dep:rustls", "dep:tokio-rustls"]
[dependencies]
tokio = { version = "1", optional = true }
rustls = { version = "0.23", optional = true }
tokio-rustls = { version = "0.26", optional = true }// Conditional compilation
#[cfg(feature = "async")]
pub async fn fetch(url: &str) -> Result<String, Error> {
reqwest::get(url).await?.text().await.map_err(Into::into)
}
#[cfg(not(feature = "std"))]
extern crate alloc; // no_std with alloc
// cfg_if for cleaner feature branches
use cfg_if::cfg_if;
cfg_if! {
if #[cfg(feature = "tls")] {
use rustls::ClientConfig;
fn make_connector() -> ClientConnector { ClientConnector::new() }
} else {
fn make_connector() -> PlainConnector { PlainConnector::new() }
}
}Cargo Profile Configuration
[profile.dev]
opt-level = 0 # No optimization (fast compile)
debug = true # Debug symbols
overflow-checks = true
[profile.release]
opt-level = 3 # Full optimization
lto = true # Link-time optimization (slower compile, smaller/faster binary)
codegen-units = 1 # Single codegen unit for best optimization
panic = "abort" # Smaller binary (no unwinding)
strip = true # Strip symbols (add strip = "debuginfo" to keep some)
# For profiling: release speed + debug symbols
[profile.profiling]
inherits = "release"
debug = true
strip = false
# For benchmarks
[profile.bench]
opt-level = 3
lto = trueEssential Cargo Plugins
# Security audit
cargo install cargo-audit
cargo audit
# Deny specific licenses/advisories
cargo install cargo-deny
cargo deny check
# Expand macros (debug derive, etc.)
cargo install cargo-expand
cargo expand -- src/models.rs
# Faster linking (dev builds)
# Linux: use lld or mold
# Cargo.toml or .cargo/config.toml:
# [target.x86_64-unknown-linux-gnu]
# linker = "clang"
# rustflags = ["-C", "link-arg=-fuse-ld=mold"]
# Unused dependencies
cargo install cargo-udeps
cargo +nightly udeps
# Outdated dependencies
cargo install cargo-outdated
cargo outdated
# Benchmark/test with coverage
cargo install cargo-llvm-cov
cargo llvm-cov --html
# Binary size analysis
cargo install cargo-bloat
cargo bloat --release
# Watch mode (recompile on save)
cargo install cargo-watch
cargo watch -x testBuild Scripts (build.rs)
// build.rs — runs before compilation
fn main() {
// Rerun only if these change
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=proto/");
println!("cargo:rerun-if-env-changed=MY_API_KEY");
// Link a C library
println!("cargo:rustc-link-lib=ssl");
println!("cargo:rustc-link-search=/usr/lib");
// Set a cfg flag
if cfg!(target_os = "windows") {
println!("cargo:rustc-cfg=windows_target");
}
// Generate code at build time
let out_dir = std::env::var("OUT_DIR").unwrap();
let dest = std::path::Path::new(&out_dir).join("generated.rs");
std::fs::write(dest, "pub const BUILD_DATE: &str = \"2025-01-01\";").unwrap();
}// main.rs: include generated code
include!(concat!(env!("OUT_DIR"), "/generated.rs"));Proc Macros (Custom Derives)
# my-macros/Cargo.toml
[lib]
proc-macro = true
[dependencies]
syn = { version = "2", features = ["full"] }
quote = "1"
proc-macro2 = "1"// my-macros/src/lib.rs
use proc_macro::TokenStream;
use quote::quote;
use syn::{parse_macro_input, DeriveInput};
#[proc_macro_derive(MyTrait)]
pub fn derive_my_trait(input: TokenStream) -> TokenStream {
let input = parse_macro_input!(input as DeriveInput);
let name = &input.ident;
let expanded = quote! {
impl MyTrait for #name {
fn name(&self) -> &str {
stringify!(#name)
}
}
};
TokenStream::from(expanded)
}Publishing to crates.io
[package]
name = "my-crate"
version = "0.1.0"
edition = "2021"
authors = ["Your Name <you@example.com>"]
description = "A short description"
license = "MIT OR Apache-2.0" # Standard Rust dual license
repository = "https://github.com/you/my-crate"
homepage = "https://my-crate.rs"
documentation = "https://docs.rs/my-crate"
keywords = ["keyword1", "keyword2"] # Max 5, searchable
categories = ["data-structures"] # From allowed list
readme = "README.md"
exclude = ["tests/", "benches/", ".github/"]cargo login # Authenticate
cargo package --list # Preview what will be published
cargo publish --dry-run # Dry run
cargo publish # PublishCI Configuration (GitHub Actions)
# .github/workflows/ci.yml
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2 # Cache build artifacts
- run: cargo test --all-features --workspace
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- run: cargo clippy --all-targets --all-features -- -D warnings
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --check
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: rustsec/audit-check@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}Anti-Patterns
# Bad: default features silently pull in async runtimes, TLS stacks, or native deps.
serde = "1"
reqwest = "0.12"
# Good: choose feature surface explicitly.
serde = { version = "1", features = ["derive"] }
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }# Bad: publish without checking packaged contents.
cargo publish
# Good: inspect and dry-run first.
cargo package --list
cargo publish --dry-runMaintenance Checklist
- Pin MSRV in docs and CI if the crate promises one.
- Audit default features for transitive dependency and compile-time impact.
- Run
cargo tree -dbefore adding crates that may duplicate versions. - Run
cargo publish --dry-runand inspectcargo package --list. - Use workspace-level dependencies for shared versions.
- Keep clippy, fmt, test, audit, and docs checks in CI.
References
- lib.rs — crate discovery
- blessed.rs — curated crate recommendations
- Cargo reference
- The rustup book
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.

