cargo-workflows
Skill4 starsChanged 9 months agoMITView on GitHub
Manage Rust projects effectively with Cargo workspaces, features, and tooling. Use when the user sets up Cargo workspaces, configures feature flags, writes build.rs scripts, prepares crates for publishing, or uses cargo clippy, cargo fmt, and other Cargo development tools.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- po4yka/rust-skillstheir own version, first seen Aug 20, 2026
- mohitmishra786/low-level-dev-skillstheir own version, first seen Apr 15, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- mohitmishra786/low-level-dev-skills★ 251same name
- po4yka/rust-skills★ 2same 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 repository78 other files it gives its agents.
- AGENTS.mdAGENTS.md
- rules/agents.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/claude-initial-setup.mdcCursor rule
- parallel-task-executionSkill
- subagent-patternsSkill
- task-coordinationSkill
- agent-communicationSkill
- context-managementSkill
- multi-agent-orchestrationSkill
- deploy-strategiesSkill
- github-actions-guideSkill
- pipeline-patternsSkill
- anthropic-sdk-guideSkill
- prompt-engineeringSkill
- tool-use-patternsSkill
- automated-review-setupSkill
- pr-standardsSkill
- review-checklistSkill
- file-organizationSkill
- immutability-patternsSkill
- naming-conventionsSkill
- branching-strategySkill
- commit-conventionsSkill
- pr-workflowSkill
- migration-patternsSkill
- query-optimizationSkill
- schema-design-guideSkill
- error-tracingSkill
- log-analysisSkill
- systematic-debuggingSkill
- django-admin-customizationSkill
- django-orm-masterySkill
- drf-api-patternsSkill
- docker-compose-guideSkill
- dockerfile-best-practicesSkill
- multi-stage-buildsSkill
- express-error-handlingSkill
- middleware-patternsSkill
- rest-api-nodeSkill
- async-fastapiSkill
- dependency-injection-fastapiSkill
- pydantic-validationSkill
- concurrency-patterns-goSkill
- error-handling-goSkill
- idiomatic-goSkill
- automation-triggersSkill
- hook-recipesSkill
- pre-post-hooksSkill
- junit-testingSkill
- maven-gradle-guideSkill
- spring-boot-patternsSkill
- mcp-resource-patternsSkill
- mcp-server-creationSkill
- mcp-tool-designSkill
- context-optimizationSkill
- knowledge-persistenceSkill
- memory-patternsSkill
- caching-strategiesSkill
- lazy-loading-patternsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 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.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 134
Run custom logic before compilation: code generation, native library linking, environment detection.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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
Cargo Workflows
Manage Rust projects with Cargo workspaces, feature flags, build scripts, and development tooling for productive, well-structured Rust development.
When to Use
- Organizing a multi-crate Rust project
- Adding optional functionality with feature flags
- Running code generation or native compilation with build.rs
- Preparing a crate for crates.io publication
- Setting up CI-friendly lint and format checks
Core Patterns
Pattern 1: Cargo Workspaces
Organize related crates in a single repository with shared dependencies and a unified build.
# Root Cargo.toml
[workspace]
resolver = "2"
members = [
"crates/core",
"crates/api",
"crates/cli",
]
# Share dependency versions across workspace members
[workspace.dependencies]
serde = { version = "1", features = ["derive"] }
tokio = { version = "1", features = ["full"] }
anyhow = "1"
tracing = "0.1"
# Shared package metadata
[workspace.package]
edition = "2021"
rust-version = "1.75"
license = "MIT"
repository = "https://github.com/user/project"# crates/core/Cargo.toml
[package]
name = "myproject-core"
version = "0.1.0"
edition.workspace = true
license.workspace = true
[dependencies]
serde.workspace = true # uses workspace version
anyhow.workspace = trueproject/
Cargo.toml # workspace root
Cargo.lock # single lock file for reproducibility
crates/
core/
Cargo.toml
src/lib.rs
api/
Cargo.toml
src/lib.rs
cli/
Cargo.toml
src/main.rsPattern 2: Feature Flags
Enable optional functionality without forcing dependencies on all users.
# Cargo.toml
[features]
default = ["json"] # enabled unless user opts out
json = ["dep:serde_json"] # optional dependency
postgres = ["dep:sqlx", "sqlx/postgres"]
full = ["json", "postgres"] # convenience feature combining others
[dependencies]
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1", optional = true }
sqlx = { version = "0.7", optional = true, features = ["runtime-tokio"] }// Conditional compilation based on features
pub fn serialize<T: serde::Serialize>(value: &T) -> Result<Vec<u8>, Error> {
#[cfg(feature = "json")]
{
return serde_json::to_vec(value).map_err(Error::Serialization);
}
#[cfg(not(feature = "json"))]
{
// Fallback to a simpler format
todo!("non-JSON serialization")
}
}
// Feature-gated modules
#[cfg(feature = "postgres")]
pub mod postgres;
// Feature-gated trait implementations
#[cfg(feature = "json")]
impl FromStr for Config {
type Err = serde_json::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
serde_json::from_str(s)
}
}Usage: cargo build --features "json,postgres" or cargo build --all-features.
Pattern 3: Build Scripts (build.rs)
Run custom logic before compilation: code generation, native library linking, environment detection.
// build.rs
fn main() {
// Tell Cargo to re-run if these change
println!("cargo::rerun-if-changed=proto/");
println!("cargo::rerun-if-env-changed=DATABASE_URL");
// Set a cfg flag based on environment
if std::env::var("CI").is_ok() {
println!("cargo::rustc-cfg=ci_build");
}
// Expose build-time info as environment variables
let git_hash = std::process::Command::new("git")
.args(["rev-parse", "--short", "HEAD"])
.output()
.ok()
.and_then(|o| String::from_utf8(o.stdout).ok())
.unwrap_or_else(|| "unknown".to_string());
println!("cargo::rustc-env=GIT_HASH={}", git_hash.trim());
// Link native libraries
println!("cargo::rustc-link-lib=sqlite3");
}// In your code, access build-time values
const GIT_HASH: &str = env!("GIT_HASH");
fn version_info() -> String {
format!("v{} ({})", env!("CARGO_PKG_VERSION"), GIT_HASH)
}Pattern 4: Publishing to crates.io
Prepare a crate for publication with proper metadata and checks.
[package]
name = "my-library"
version = "0.2.0"
edition = "2021"
description = "A concise description of what this crate does"
license = "MIT OR Apache-2.0"
repository = "https://github.com/user/my-library"
documentation = "https://docs.rs/my-library"
readme = "README.md"
keywords = ["keyword1", "keyword2"] # max 5
categories = ["development-tools"]
exclude = ["tests/fixtures/*", ".github/"]
rust-version = "1.75" # MSRV# Pre-publish checklist
cargo fmt --check # formatting
cargo clippy -- -D warnings # lints as errors
cargo test # all tests pass
cargo doc --no-deps # docs build
cargo package --list # review included files
cargo publish --dry-run # verify packaging
# Publish
cargo publishPattern 5: Clippy and Fmt Configuration
Configure linting and formatting for consistent code quality.
# Cargo.toml -- workspace-level clippy config
[workspace.lints.clippy]
all = { level = "warn", priority = -1 }
pedantic = { level = "warn", priority = -1 }
nursery = { level = "warn", priority = -1 }
# Allow specific lints you disagree with
module_name_repetitions = "allow"
must_use_candidate = "allow"
missing_errors_doc = "allow"
[workspace.lints.rust]
unsafe_code = "forbid"
missing_debug_implementations = "warn"# crates/core/Cargo.toml
[lints]
workspace = true # inherit workspace lint config# rustfmt.toml
edition = "2021"
max_width = 100
use_field_init_shorthand = true
imports_granularity = "Crate"
group_imports = "StdExternalCrate"# CI commands
cargo fmt --all -- --check # check formatting
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-featuresAnti-Patterns
- Massive single-crate projects -- Split into workspace members when crate compile time becomes a bottleneck. Each member compiles independently.
- Features that change behavior rather than add it -- Features should be
additive. A crate with feature A enabled should be a superset of the crate
without it. Do not use features to toggle between alternative implementations.
# BAD: mutually exclusive features [features] backend_a = [] backend_b = [] # GOOD: additive features [features] postgres = ["dep:sqlx"] caching = ["dep:redis"] - Skipping
cargo clippyin CI -- Clippy catches real bugs. Run it with-D warningsto treat lints as errors in CI. - Not pinning workspace dependency versions -- Use
Cargo.lockfor applications (commit it to git). For libraries, letCargo.lockbe gitignored but use workspace dependencies for consistency. - Overly broad
build.rsre-run triggers -- Usecargo::rerun-if-changedandcargo::rerun-if-env-changedto avoid unnecessary rebuilds.
Quick Reference
| Command | Purpose |
cargo build --workspace | Build all workspace members |
cargo test --workspace | Test all workspace members |
cargo clippy --workspace | Lint all workspace members |
cargo fmt --all | Format all workspace members |
cargo build --features "x,y" | Build with specific features |
cargo build --all-features | Build with every feature enabled |
cargo build --no-default-features | Build without default features |
cargo publish --dry-run | Verify packaging without publishing |
cargo doc --open | Build and open documentation |
cargo tree | Show dependency tree |
cargo udeps | Find unused dependencies |
cargo deny check | Audit licenses and advisories |
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.

