Rust Project Setup
Rule
Scaffold a brand-new Rust project; do not only propose a structure. Layer Rust-specific
conventions on top of base-repo-setup and target greenfield work only.
Greenfield Rust should be Cargo-first, safe by default, explicit about MSRV and features,
and dependency-minimal until a real domain need exists.
Hard Stops
Stop before writing files when:
- The repository baseline is missing (
flake.nix, mise.toml, justfile, .gitignore).
- The target already has
Cargo.toml, Cargo.lock, src/, tests/, or files that would be
overwritten.
- Crate name, app/library shape, workspace shape, edition, MSRV, license, or publish intent
is unclear.
- The request is a migration of an existing Rust project; these skills are greenfield-only.
- Setup would introduce async runtime, HTTP framework, database, config framework,
OpenTelemetry, unsafe code, FFI, or release automation without approval.
Required Decisions
Ask and confirm:
- Crate or workspace name. Use kebab-case package names and snake_case library crate names.
- Shape: binary app, library crate, mixed app+lib, or workspace.
- Edition. Recommend Rust 2024 when supported by the chosen stable toolchain.
- MSRV. Libraries need explicit MSRV; apps may track stable unless release policy says
otherwise.
- License, description, repository URL, and publish intent.
- Whether CLI, HTTP API, async, database, config, observability, benchmarks, docs examples,
or release automation are in scope. Default is no; use specialized skills later.
Greenfield Defaults
- Use stable Rust. Pin toolchain through repo policy when the project requires repeatability.
- Prefer
cargo new --bin or cargo new --lib shape, then adjust deliberately.
- Use
src/main.rs for binaries, src/lib.rs for libraries, and tests/ for integration
tests.
- Add a workspace only when multiple crates are requested.
- Track
Cargo.lock for apps and binaries. Discuss lockfile policy for libraries and
workspaces; default to tracking it in this personal baseline for reproducibility.
- Keep dependencies empty initially unless generated code imports them.
- Use
rustfmt, Clippy, cargo test, cargo test --doc, and cargo doc --no-deps in
validation.
- Use
cargo-nextest only when approved or already standard; cargo test remains the
portable baseline.
- Use
cargo-deny for license/advisory policy and cargo-audit only when the repo chooses
it; do not add both without need.
Just Recipes
Keep just check as the canonical validation entrypoint. Prefer recipes like:
fmt:
cargo fmt --all
fmt-check:
cargo fmt --all -- --check
lint:
cargo clippy --all-targets --all-features -- -D warnings
test:
cargo test --all-targets --all-features
doc:
cargo doc --no-deps --all-features
check: fmt-check lint test doc
Add nextest, deny, audit, coverage, or bench recipes only when those tools are
approved and versioned through project tooling.
Workflow
- Verify the baseline repository files and Git root.
- Ask all required decisions.
- Create Cargo metadata, source skeleton, smoke tests, README updates, and just recipes.
- Add
.gitignore entries for generated Rust artifacts only when missing (target/,
coverage/profiling outputs). Do not ignore Cargo.lock without approval.
- Run
cargo fmt, cargo test, cargo clippy, cargo doc, and just check.
Completion
Report crate/workspace shape, edition/MSRV, lockfile policy, files created, dependencies
added or avoided, commands run, validation results, and intentionally skipped optional items
such as Tokio, Axum, Clap, SQLx, OpenTelemetry, CI, and release automation.
Source: nyquistwilder/personal-pi — distributed by TomeVault.
1---2name: rust-project-setup-23description: Set up a brand-new greenfield Rust crate or workspace after base-repo-setup, using modern Cargo layout, Edition 2024 when supported, explicit MSRV, rustfmt, Clippy, tests/docs, cargo-nextest when approved, cargo-deny/audit gates, and local just check validation. Use only for new Rust scaffolding, not migrations. Use when this capability is needed.4---56# Rust Project Setup78## Rule910Scaffold a brand-new Rust project; do not only propose a structure. Layer Rust-specific11conventions on top of `base-repo-setup` and target greenfield work only.1213Greenfield Rust should be Cargo-first, safe by default, explicit about MSRV and features,14and dependency-minimal until a real domain need exists.1516## Hard Stops1718Stop before writing files when:1920- The repository baseline is missing (`flake.nix`, `mise.toml`, `justfile`, `.gitignore`).21- The target already has `Cargo.toml`, `Cargo.lock`, `src/`, `tests/`, or files that would be22 overwritten.23- Crate name, app/library shape, workspace shape, edition, MSRV, license, or publish intent24 is unclear.25- The request is a migration of an existing Rust project; these skills are greenfield-only.26- Setup would introduce async runtime, HTTP framework, database, config framework,27 OpenTelemetry, unsafe code, FFI, or release automation without approval.2829## Required Decisions3031Ask and confirm:32331. Crate or workspace name. Use kebab-case package names and snake_case library crate names.342. Shape: binary app, library crate, mixed app+lib, or workspace.353. Edition. Recommend Rust 2024 when supported by the chosen stable toolchain.364. MSRV. Libraries need explicit MSRV; apps may track stable unless release policy says37 otherwise.385. License, description, repository URL, and publish intent.396. Whether CLI, HTTP API, async, database, config, observability, benchmarks, docs examples,40 or release automation are in scope. Default is no; use specialized skills later.4142## Greenfield Defaults4344- Use stable Rust. Pin toolchain through repo policy when the project requires repeatability.45- Prefer `cargo new --bin` or `cargo new --lib` shape, then adjust deliberately.46- Use `src/main.rs` for binaries, `src/lib.rs` for libraries, and `tests/` for integration47 tests.48- Add a workspace only when multiple crates are requested.49- Track `Cargo.lock` for apps and binaries. Discuss lockfile policy for libraries and50 workspaces; default to tracking it in this personal baseline for reproducibility.51- Keep dependencies empty initially unless generated code imports them.52- Use `rustfmt`, Clippy, `cargo test`, `cargo test --doc`, and `cargo doc --no-deps` in53 validation.54- Use `cargo-nextest` only when approved or already standard; `cargo test` remains the55 portable baseline.56- Use `cargo-deny` for license/advisory policy and `cargo-audit` only when the repo chooses57 it; do not add both without need.5859## Just Recipes6061Keep `just check` as the canonical validation entrypoint. Prefer recipes like:6263```make64fmt:65 cargo fmt --all6667fmt-check:68 cargo fmt --all -- --check6970lint:71 cargo clippy --all-targets --all-features -- -D warnings7273test:74 cargo test --all-targets --all-features7576doc:77 cargo doc --no-deps --all-features7879check: fmt-check lint test doc80```8182Add `nextest`, `deny`, `audit`, `coverage`, or `bench` recipes only when those tools are83approved and versioned through project tooling.8485## Workflow86871. Verify the baseline repository files and Git root.882. Ask all required decisions.893. Create Cargo metadata, source skeleton, smoke tests, README updates, and just recipes.904. Add `.gitignore` entries for generated Rust artifacts only when missing (`target/`,91 coverage/profiling outputs). Do not ignore `Cargo.lock` without approval.925. Run `cargo fmt`, `cargo test`, `cargo clippy`, `cargo doc`, and `just check`.9394## Completion9596Report crate/workspace shape, edition/MSRV, lockfile policy, files created, dependencies97added or avoided, commands run, validation results, and intentionally skipped optional items98such as Tokio, Axum, Clap, SQLx, OpenTelemetry, CI, and release automation.99100---101> Source: [nyquistwilder/personal-pi](https://github.com/nyquistwilder/personal-pi) — distributed by [TomeVault](https://tomevault.io).102<!-- tomevault:4.0:skill_md:2026-06-16 -->