Choose Rust Project Shape
Purpose
Pick the smallest correct Rust project shape before code changes begin.
The practical decision is what kind of crate or workspace the user needs, where package boundaries should sit, whether MSRV or edition policy already exists, and which validation commands should prove the work.
Source Check
Use repo-local Rust files, checked-out dependency sources, Dash MCP or Dash HTTP for installed Rust docsets, and then official Rust documentation when Dash/local coverage is missing or stale. Check one of those source-specific paths before making claims about Rust, Cargo, rustup, formatting, linting, testing, or package behavior:
Translate any documentation rule into the concrete repository decision it changes.
Classification Workflow
- Inspect the repository shape:
Cargo.toml
Cargo.lock
rust-toolchain.toml or rust-toolchain
.cargo/config.toml
rustfmt.toml or .rustfmt.toml
clippy.toml
src/main.rs
src/lib.rs
tests/
examples/
benches/
crates/
- existing CI commands
- Identify the user-visible job:
- binary crate
- library crate
- CLI tool
- service or daemon
- Cargo workspace
- proc macro
- FFI boundary
- embedded or
no_std target
- package maintenance or upgrade pass
- Choose the project boundary intentionally:
- use one package for a small app or library
- use a workspace when multiple packages need shared dependency and validation behavior
- split a library from a binary when reusable API and executable concerns are meaningfully separate
- split proc macros into their own crate
- keep FFI boundaries explicit and narrow
- Check compatibility policy:
- preserve existing Rust edition unless the task is an edition migration
- preserve existing MSRV unless the user approves changing it
- read CI before recommending toolchain or feature matrix changes
- Choose validation:
cargo fmt --check for formatting-sensitive changes
cargo clippy --all-targets --all-features when lint coverage matters
cargo test for behavior
cargo build for compile checks without tests
cargo package for publishable crate surfaces
Recommendations
Binary Crate Or CLI
Use a single binary package for small command-line tools. Add a library target only when the CLI has reusable logic that tests or downstream callers should exercise directly.
Handoff:
rust:bootstrap-cargo-project for new project creation
rust:testing-workflow for behavior coverage
rust:tooling-style-workflow for formatting, linting, and toolchain alignment
Library Crate
Use a library package when the primary output is an API consumed by tests, examples, binaries, or downstream users. Keep public API surface small and document package validation if publishing is expected.
Handoff:
rust:testing-workflow for unit, integration, and doctest coverage
rust:package-workflow when crate metadata or publication matters
Cargo Workspace
Use a workspace only when more than one package needs shared dependency resolution, coordinated tests, or separate crate boundaries.
Good reasons include a library plus CLI package, a proc macro companion crate, integration-test support crates, or multiple crates that ship together. Avoid a workspace when a module split inside one crate would be enough.
Proc Macro
Use a dedicated proc macro crate. Keep parsing and code generation tests explicit because failures are often easier to understand with fixture-style coverage.
FFI, Embedded, Or no_std
Treat these as explicit constraint-driven shapes. Check existing target, build script, linker, feature, and CI configuration before changing layout.
Output Shape
Return:
Chosen shape: binary crate, library crate, CLI, service, workspace, proc macro, FFI, embedded or no_std, or maintenance pass.
Project boundary: package, crate, workspace member, or module split.
Compatibility policy: edition, MSRV, toolchain, and feature constraints.
Validation path: exact format, lint, build, test, or package commands.
Documentation updates: README, roadmap, package notes, or repo-local guidance.
Next skill: the next Rust skill to use.
Guardrails
- Do not create a workspace when one package and clear modules are enough.
- Do not invent or raise MSRV without evidence and user intent.
- Do not add local path dependencies to public or shared package surfaces.
- Do not publish packages by default.
- Do not use nightly-only features unless the repo already depends on nightly or the user approves that constraint.
1---2name: choose-project-shape3description: Choose the right Rust project shape before implementation, including crate type, Cargo package or workspace layout, edition and MSRV checks, validation commands, package boundaries, and documentation updates. Use when a user wants to start, restructure, or extend a Rust project and the binary, library, workspace, CLI, service, proc macro, FFI, embedded, no_std, or maintenance shape is not already settled.4license: Apache-2.05---67# Choose Rust Project Shape89## Purpose1011Pick the smallest correct Rust project shape before code changes begin.1213The practical decision is what kind of crate or workspace the user needs, where package boundaries should sit, whether MSRV or edition policy already exists, and which validation commands should prove the work.1415## Source Check1617Use repo-local Rust files, checked-out dependency sources, Dash MCP or Dash HTTP for installed Rust docsets, and then official Rust documentation when Dash/local coverage is missing or stale. Check one of those source-specific paths before making claims about Rust, Cargo, rustup, formatting, linting, testing, or package behavior:1819- [Rust documentation](https://doc.rust-lang.org/)20- [The Cargo Book](https://doc.rust-lang.org/cargo/)21- [`cargo new`](https://doc.rust-lang.org/cargo/commands/cargo-new.html)22- [Cargo tests guide](https://doc.rust-lang.org/cargo/guide/tests.html)23- [Cargo continuous integration guide](https://doc.rust-lang.org/cargo/guide/continuous-integration.html)24- [The rustup book](https://rust-lang.github.io/rustup/)25- [Clippy documentation](https://doc.rust-lang.org/clippy/)2627Translate any documentation rule into the concrete repository decision it changes.2829## Classification Workflow30311. Inspect the repository shape:32 - `Cargo.toml`33 - `Cargo.lock`34 - `rust-toolchain.toml` or `rust-toolchain`35 - `.cargo/config.toml`36 - `rustfmt.toml` or `.rustfmt.toml`37 - `clippy.toml`38 - `src/main.rs`39 - `src/lib.rs`40 - `tests/`41 - `examples/`42 - `benches/`43 - `crates/`44 - existing CI commands452. Identify the user-visible job:46 - binary crate47 - library crate48 - CLI tool49 - service or daemon50 - Cargo workspace51 - proc macro52 - FFI boundary53 - embedded or `no_std` target54 - package maintenance or upgrade pass553. Choose the project boundary intentionally:56 - use one package for a small app or library57 - use a workspace when multiple packages need shared dependency and validation behavior58 - split a library from a binary when reusable API and executable concerns are meaningfully separate59 - split proc macros into their own crate60 - keep FFI boundaries explicit and narrow614. Check compatibility policy:62 - preserve existing Rust edition unless the task is an edition migration63 - preserve existing MSRV unless the user approves changing it64 - read CI before recommending toolchain or feature matrix changes655. Choose validation:66 - `cargo fmt --check` for formatting-sensitive changes67 - `cargo clippy --all-targets --all-features` when lint coverage matters68 - `cargo test` for behavior69 - `cargo build` for compile checks without tests70 - `cargo package` for publishable crate surfaces7172## Recommendations7374### Binary Crate Or CLI7576Use a single binary package for small command-line tools. Add a library target only when the CLI has reusable logic that tests or downstream callers should exercise directly.7778Handoff:7980- `rust:bootstrap-cargo-project` for new project creation81- `rust:testing-workflow` for behavior coverage82- `rust:tooling-style-workflow` for formatting, linting, and toolchain alignment8384### Library Crate8586Use a library package when the primary output is an API consumed by tests, examples, binaries, or downstream users. Keep public API surface small and document package validation if publishing is expected.8788Handoff:8990- `rust:testing-workflow` for unit, integration, and doctest coverage91- `rust:package-workflow` when crate metadata or publication matters9293### Cargo Workspace9495Use a workspace only when more than one package needs shared dependency resolution, coordinated tests, or separate crate boundaries.9697Good reasons include a library plus CLI package, a proc macro companion crate, integration-test support crates, or multiple crates that ship together. Avoid a workspace when a module split inside one crate would be enough.9899### Proc Macro100101Use a dedicated proc macro crate. Keep parsing and code generation tests explicit because failures are often easier to understand with fixture-style coverage.102103### FFI, Embedded, Or `no_std`104105Treat these as explicit constraint-driven shapes. Check existing target, build script, linker, feature, and CI configuration before changing layout.106107## Output Shape108109Return:1101111. `Chosen shape`: binary crate, library crate, CLI, service, workspace, proc macro, FFI, embedded or `no_std`, or maintenance pass.1122. `Project boundary`: package, crate, workspace member, or module split.1133. `Compatibility policy`: edition, MSRV, toolchain, and feature constraints.1144. `Validation path`: exact format, lint, build, test, or package commands.1155. `Documentation updates`: README, roadmap, package notes, or repo-local guidance.1166. `Next skill`: the next Rust skill to use.117118## Guardrails119120- Do not create a workspace when one package and clear modules are enough.121- Do not invent or raise MSRV without evidence and user intent.122- Do not add local path dependencies to public or shared package surfaces.123- Do not publish packages by default.124- Do not use nightly-only features unless the repo already depends on nightly or the user approves that constraint.