new-crate
Add a new crate to the OpenDataSuite Cargo workspace with correct layering, metadata, lints, and test scaffolding. Use when creating ods-* module crates, provider crates, or stores, or when scaffoldin
SKILL.mdskills/new-crate/SKILL.md
GitHubAdd a crate
Decide where it goes
| Kind | Path | May depend on |
|---|---|---|
Core/domain (ods-core, ods-events, ods-config, ods-policy) |
crates/ |
std, serde, small utility crates; ods-core depends on nothing internal |
Contracts (ods-sdk) |
crates/ |
ods-core, foundation crates |
Module (ods-state, ods-erd, …) |
crates/ |
core, sdk, other modules only if ADR-approved |
Provider/store (ods-provider-*, ods-store-*) |
providers/ |
core, foundation, sdk, vendor client libs — never modules |
Binary (ods-cli) |
crates/ |
anything |
A module crate must never depend on a provider crate. If you need one, you need a new
contract in ods-sdk instead.
First-time workspace scaffold
If no root Cargo.toml exists, create it with:
[workspace] resolver = "3",members = ["crates/*"]— add"providers/*"with the first provider crate (Cargo rejects a glob that matches nothing)[workspace.package]edition = "2024", license = (per #10/#101, defaultApache-2.0), repository, rust-version[workspace.dependencies]pinning shared deps (serde, thiserror, tokio, clap, tracing)[workspace.lints.rust] unsafe_code = "forbid";[workspace.lints.clippy] all = "warn", pedantic = "warn"(allow noisy ones explicitly)rust-toolchain.toml(stable),deny.toml,.github/workflows/ci.ymlrunning theverifystages.
Per-crate steps
cargo new --lib crates/<name>(orproviders/<name>); binaries use--bin.- In its
Cargo.toml:version.workspace = true,edition.workspace = true,license.workspace = true,[lints] workspace = true; usedep.workspace = truefor shared deps. src/lib.rsstarts with a crate-level doc comment stating purpose and allowed dependencies.- Add at least one unit test and, for providers, wire the SDK conformance tests.
- Register the crate's layer in
scripts/check-layering.py(unknown crates fail CI). - Update the layout in
docs/ROADMAP.md§7 / AGENTS.md if the crate is new to the plan. - Run the
verifyskill.