Production-ready Rust workspace template engineered for both human maintainers and AI coding agents, enforcing the Google Rust Style Guide and automated structural hygiene gates out of the box.
- Strictly flat, small-crate workspace: Splits reusable library logic
(
crates/rust-template) from the binary entrypoint (crates/rust-template-cli). Every crate keeps its.rssources in a flatsrc/directory (< 20 KBper file for single-call agent reads) with externalizedtests.rsunit tests. - Google Rust Style Guide enforcement: Combines workspace
rustc/clippylints (Cargo.toml, clippy.toml), formatting rules (rustfmt.toml), and pure-Rust structural and workflow test suites (crates/rust-template/tests/hygiene.rs and crates/rust-template/tests/workflow.rs). - First-class AI agent customization: Ships canonical routing in
AGENTS.md, persistent architectural memory in
.ai/memory/README.md, scoped file instructions in
.github/instructions/, workflow skills in.github/skills/, specialist agents in.github/agents/, slash prompts in.github/prompts/, and deterministic lifecycle hooks in .github/hooks/guardrails.json. - Zero-dependency starter & fast offline gate: Builds and tests in under two
seconds using only
std, with cross-platform verification, package consumer validation, stripped production artifact packaging, and bootstrap scripts inscripts/(.shand.ps1).
Rename the workspace crates, binary, repository metadata, and documentation in one command:
# Preview changes without modifying files
bash ./scripts/init-project.sh my-project --org my-org --dry-run
# Apply rename and run the verification gate
bash ./scripts/init-project.sh my-project --org my-orgOn Windows PowerShell:
pwsh -NoProfile -File ./scripts/init-project.ps1 -Name my-project -Org my-orguse rust_template::{Config, Engine, Limit, OutputMode};
fn main() -> rust_template::Result<()> {
let limit = Limit::try_new(10)?;
let config = Config::new()
.output_mode(OutputMode::Detailed)
.max_items(limit)
.prefix("item");
let engine = Engine::new(config);
let report = engine.process(["alpha", "beta"])?;
assert_eq!(report.len(), 2);
println!("{}", report.render());
Ok(())
}cargo run -p rust-template-cli -- --mode detailed --limit 5 --prefix item alpha betaRun the full verification gate before every commit:
bash ./scripts/check.sh
# or on PowerShell:
pwsh -NoProfile -File ./scripts/check.ps1Run the read-only codebase health survey at any time:
bash ./.github/skills/codebase-consolidation/survey.shDual-licensed under MIT OR Apache-2.0 (LICENSE-MIT and
LICENSE-APACHE).