Scaffold a new module following project structure conventions from tech-stack.md. Creates files, wires up mod.rs, adds test scaffolding. Use when asked to "create a module", "scaffold", or "add a new module".
/add-module <name> — create a module with the given name/add-module <parent>/<name> — create a submodule under the specified parent/add-module <name> or /add-module <parent>/<name>"[ -f Cargo.toml ] && echo "CARGO_OK" || echo "NO_CARGO"
[ -f docs/tech-stack.md ] && echo "TECHSTACK_OK" || echo "NO_TECHSTACK"
If NO_CARGO: "No Cargo.toml found." — STOP.
Read docs/tech-stack.md to check:
$ARGUMENTS is not in the planned architecture (docs/tech-stack.md)."Read docs/requirements.md to find relevant requirement IDs.
Determine if this needs a directory module or single-file module:
Directory module (if it will have multiple files or submodules):
src/<parent>/<name>/
├── mod.rs # Re-exports only
└── <impl>.rs # Implementation
Single-file module (if it's self-contained):
src/<parent>/<name>.rs
//! Brief description of the module.
mod implementation;
pub use implementation::PublicType;
pub(crate) use implementation::InternalHelper;
//! Detailed description of this file's responsibility.
use std::path::Path;
use serde::Serialize;
use crate::errors::RepostatError;
// Implementation here
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn placeholder_compiles() {
// Replace with real tests before implementing features
}
}
mod <name>; to the parent module's mod.rs or lib.rs/main.rs.pub use re-exports.Cargo.toml, add them with a justification comment:
# Required for <module> — <justification per constitution §8>
new_dep = "1"
cargo check 2>&1
cargo test 2>&1
Both must pass. The placeholder test confirms the module compiles.
When the module compiles and tests pass, the skill is done. Do NOT print a summary box.
pub(crate) over pub. Only export what consumers need.When finished, do not end the session, continue on to the next skill controlled by /go skill.