A concise, reusable guide for human and AI contributors. Customize the bracketed fields for each project.
Project: [PROJECT_NAME]
Primary language: Rust (stable)
UI layer: [CHOOSE ONE: Leptos/React/etc.] (single framework)
API layer: [Axum/Actix/etc.]
Build/bundle: [Trunk/cargo-leptos/—]
Target platform: Fedora (dnf/rpm)
- Rust stable only. No nightly/unstable features.
- One UI stack. Do not mix frameworks; follow the project’s chosen UI layer.
- API is thin. Routes/serde/auth live in API crate; business logic lives in library crates.
- Workspace layout:
web/
= UI only (views, state, API calls).api/
= HTTP only (routes, mapping, errors).libs/*
= domain logic (models, traits, persistence, orchestration).
- Separation of concerns: UI ↔ API ↔ Libs boundary is enforced.
- Small, composable crates: New domain areas → new lib crate.
- Security & least privilege: Rootless by default; no elevation on dev hosts.
- Reproducibility: Builds succeed on clean Fedora hosts with stable Rust.
- Use latest stable releases from crates.io. No pre-releases, no git refs (unless critical fix, documented in
.docs/deps-exceptions.md
). - Prefer caret SemVer ranges (
"0.x"
) over exact pins; avoid wildcards. - Keep features minimal; prefer
rustls
when applicable. - Validate:
cargo update -p <dep>
+cargo check
at workspace rootcargo tree -d
has no conflicts- UI bundling (e.g.,
trunk build
) succeeds if applicable
- Fedora-first: documentation/scripts target
dnf/rpm
. Do not addapt
/Debian/Ubuntu instructions. - Containers: Rootless Podman only; rpm-based base images; Quadlet for systemd integration.
- Avoid
curl | bash
installers; prefer packaged approaches (official repos or COPR when justified).
- Functional comments only (what/how, invariants, safety).
- No design essays in code. Long-form rationale goes to
.docs/<topic>.md
(gitignored) and is summarized in the PR.
- No
sudo
or elevation attempts by agents or scripts on developer workstations. - Provide rootless alternatives; fail fast with instructions when a privileged step is operator-only (CI/ops).
- Ask for clarification when requirements are incomplete/ambiguous/contradictory. Propose options and a default.
- If partially blocked, implement the minimal, reversible path and mark TODOs.
- Must compile on stable at workspace root:
cargo build --workspace --all-targets --release
- UI bundle (if present) builds cleanly (e.g.,
cd web && trunk build --release
).
- Prefer zero warnings. Scope any
#[allow(...)]
narrowly with a one-line reason. - Clippy/fmt recommended:
cargo clippy -- -D warnings
,cargo fmt --all --check
. - Tests pass (
cargo test --workspace -q
) when present.
- Implementation in libs, not hard-coded into UI/API.
- Latest stable dependencies; minimal features.
- Builds cleanly (workspace + UI bundle).
- Rootless Podman (no Docker); no Debian/Ubuntu instructions.
- No
sudo
usage in dev flows. - Comments are concise & functional; long rationale in
.docs/
. - Clarifications sought where guidance was incomplete.