- Consider the project a monorepo containing multiple crates unless explicitly told otherwise.
- Follow the existing crate/workspace layout. If creating a new workspace, prefer a simple, discoverable structure (e.g. crates under
crates/). - Treat
target/as build output only; do not commit artifacts. - Capture architectural decisions in Markdown ADRs under
docs/decisions/.
- NEVER add directly to
Cargo.tomlfiles. - ALWAYS use
cargo add - For the following types of functionality, use:
- CLI:
clap(derive) +clap_completefor completions,clap_mangenfor manpages - Errors:
thiserrorin libraries;anyhowin binaries. - Logging:
tracing+tracing_subscriber. - YAML:
saphyr - Serialization:
serde+serde_json+serde-saphyr - Testing (CLI):
assert_cmd+predicates; snapshots viainsta. - Async:
tokiowhen async is required; otherwise stay sync. - HTTP:
reqwest(client),axum(server) when needed. - Paths:
camino, since we don't always know when UTF-8 paths are required. - Testing:
cargo nextest,cargo llvm-cov nextestfor coverage. - Configuration:
config
- CLI:
just --list— show available recipes (preferred entrypoint ifjustis installed).just check— format, lint, deny, tests (nextest), and doctests.just fmt— format.just clippy— lint (CI-level strict).just deny— check dependencies for security advisories and license compliance (requirescargo-deny).just test(orcargo nt) — tests (requirescargo-nextest).just doc-test(orcargo doc-test) — doctests.cargo check --all-targets --all-features— fast compile sanity check.- Optional:
just cov(orcargo cov) — coverage (requirescargo-llvm-cov). - Optional:
markdownlint— lint Markdown files.
- Rust 2024 edition;
#![deny(unsafe_code)]in each crate — keep contributions safe and pure Rust. - Prefer idiomatic, readable Rust; rely on
rustfmtdefaults. - Keep clippy clean; avoid
unsafeunless there’s a clear, documented need. - Use standard Rust naming:
snake_case(items),UpperCamelCase(types/traits). - For public APIs: add rustdoc, examples when helpful, and keep semver impact in mind.
- If you change behavior, add/adjust tests in the same change.
- Prefer fast, deterministic tests; use integration tests for end-to-end behavior.
just covoutput should exceed 90% prior to any commit.
- Follow Conventional Commits (
feat:,fix:,docs:,perf:,chore:) for clarity. - PRs ALSO follow conventional commit style, and should include: purpose, scope of files touched, manual checks performed, and open questions.
- Link related issues if available.
- Never make commits directly. Write commit message to
commit.txt. If branch is clean, make surecommit.txtis empty before writing to it. Otherwise, append since changes are accumulating prior to commit.
- Set
package.rust-versioninCargo.toml(if not already set) and keep it intentional. - CI runs an MSRV compile check when
rust-versionis present.
- If you capture architectural decisions, prefer lightweight ADRs under
docs/decisions/.
- Publishing to crates.io requires the
CARGO_REGISTRY_TOKENGitHub Actions secret. - Keep
CHANGELOG.mdup to date for user-visible changes.
- Do not commit secrets. Prefer environment variables for credentials and document configuration defaults.
deny.tomlconfigurescargo-denyfor supply chain security: license compliance, vulnerability scanning, and source verification.