rust-module-layout

Installation
SKILL.md

Rust Module Layout (Inside a Single Crate)

Authority: The Rust Book ch7, Rust Reference ch7, Rust API Guidelines — Organization (C-HIERARCHY, C-REEXPORT), Rust Style Guide.

This skill is the crate-internal counterpart to rust-workspace. That skill decides crate boundaries (workspace, packages, dependency direction). This skill decides what lives inside one crate's src/: the file tree, the mod declarations, the visibility, and the public re-export surface.

Capability Boundaries

✅ Strengths

  1. Translating a logical module hierarchy into a physical src/ directory tree
  2. Writing lib.rs / main.rs as a thin index, not a dumping ground
  3. Choosing between foo.rs / foo/mod.rs / foo/ (Edition 2018+ vs legacy)
  4. Naming modules semantically (connection rather than db, runtime rather than rt)
  5. Applying pub / pub(crate) / pub(super) / pub(in path) deliberately
  6. Designing a flat public facade over a deep private tree via targeted pub use
  7. Recognizing and refactoring the "flat lib.rs + pub use *::*" anti-pattern (common in crates ported from Java/Python)
  8. Splitting a 500+ line file into a directory without breaking callers
  9. Migrating legacy mod.rs layouts to the modern foo.rs + foo/ form
Installs
2
GitHub Stars
1
First Seen
6 days ago
rust-module-layout — full-stack-skills/rust-skills