rust-source-layout
Rust Source Layout
Use architecture-guidance for responsibility/dependency decisions and
rust-practices for implementation. If needed guidance is unavailable, report the
gap before making the affected decision. This skill specifies paths, not a workflow.
Applicability
For new crates, and when establishing the first substantial feature in an existing
crate, first identify the crate's architectural scope. A crate spanning domain,
application, and adapter responsibilities uses explicit role directories. A crate
dedicated to one role treats its crate root as that boundary and does not repeat the
role in its paths. For example, a domain-only crate uses src/<domain_concept>/, not
src/domain/<domain_concept>/.
Small size alone is not an exemption from separating distinct responsibilities: a small mixed-responsibility CLI still separates domain behavior from argument decoding and output formatting. Conversely, a focused crate does not add empty or redundant layer directories merely to resemble an application crate.