Cargo Workflows
Purpose
Guide agents through Cargo workspaces, feature management, build scripts (build.rs), CI integration, incremental compilation, and the Cargo tool ecosystem.
Triggers
- "How do I set up a Cargo workspace with multiple crates?"
- "How do features work in Cargo?"
- "How do I write a build.rs script?"
- "How do I speed up Cargo builds in CI?"
- "How do I audit my Rust dependencies?"
- "What is cargo nextest and should I use it?"
Workflow
1. Workspace setup
2. Feature flags
Feature gotchas:
- Features are additive: once enabled anywhere in the dependency graph, they stay enabled
resolver = "2"prevents feature leakage between dev-dependencies and regular deps- Use
dep:optional_depsyntax (edition 2021) to avoid implicit feature creation
3. Build scripts (build.rs)
4. Incremental builds and CI caching
5. cargo nextest (faster test runner)
nextest.toml:
6. Dependency management and auditing
deny.toml:
7. Useful cargo commands
For workspace patterns and dependency resolution details, see references/workspace-patterns.md [blocked].
Related skills
- Use
skills/rust/rustc-basicsfor compiler flags and profile configuration - Use
skills/rust/rust-debuggingfor debugging Cargo-built binaries - Use
skills/rust/rust-ffiforbuild.rswith C library bindings - Use
skills/build-systems/cmakewhen integrating Rust into a CMake build


