OpenParable
Skip to content
← Back to skills

Rust Modern Modules

Development
rust-modern-modules

Rust Modern Modules is an Agent Skill for development published in the AkimioJR/AutoFilm repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Enforce modern Rust module file layout. Use when Codex creates, splits, moves, or refactors Rust modules, especially when deciding between `mod.rs` and `foo.rs` plus `foo/bar.rs` layouts.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/AkimioJR/AutoFilm/blob/HEAD/.agents/skills/rust-modern-modules/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/rust-modern-modules, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Rust Modern Modules

Rule

Prefer Rust 2018+ module layout:

src/foo.rs
src/foo/bar.rs

Use this from src/foo.rs:

mod bar;

Do not create src/foo/mod.rs for new modules unless the repository already consistently uses mod.rs in that area or the user explicitly asks for it.

Workflow

  1. Inspect nearby Rust modules before creating files.
  2. If both layouts are viable, choose foo.rs as the parent module and foo/*.rs for children.
  3. If refactoring an existing mod.rs, avoid moving it unless the user asked for a layout cleanup or the move is necessary for the task.
  4. Keep module declarations private by default: use mod child; first, then widen to pub mod child; only when external access is needed.
  5. Run cargo fmt after moving or creating Rust module files.

Examples

For a logging module with a daily appender, prefer:

src/logging.rs
src/logging/daily_file_appender.rs

Inside src/logging.rs:

mod daily_file_appender;

use daily_file_appender::DailyFileAppender;