Build Tauri v2 applications with small Rust command surfaces, secure capabilities, explicit IPC contracts, and maintainable distribution workflows.
Operating Model
- Inspect the Tauri version and generated structure first:
src-tauri,tauri.conf.json, capabilities, permissions, plugins, frontend invocation code, and CI/release scripts. - Treat every command as a public bridge contract. Validate input, return typed serializable results, and keep filesystem/shell/network capabilities narrow.
- Prefer app-owned Rust services behind commands. Do not put large domain logic directly in
#[tauri::command]functions. - Keep the capability model least-privilege by default. Avoid broad filesystem, shell, opener, and dialog permissions unless the user workflow truly needs them.
- Coordinate with the general
tauri-v2skill when available for framework-specific current docs; use this skill for Rust architecture, security, testing, and command design.
Reference Map
references/tauri-v2-rust-backend.mdfor command/state/plugin architecture and typed IPC.references/capabilities-security.mdfor permissions, filesystem/shell risk, secrets, updater, and secure defaults.references/distribution-mobile.mdfor bundling, updater, sidecars, signing, desktop/mobile packaging, and release checks.
Defaults
- Keep commands async only when they await I/O. Do CPU-heavy work off the main runtime.
- Use
serdeDTOs at the IPC boundary and convert to domain types inside services. - Use
tauri::Statefor shared app services with clear ownership; avoid global mutable statics. - Use plugin APIs instead of hand-rolled platform code when mature official plugins cover the use case.
- Keep frontend-originated paths, URLs, and shell arguments untrusted until validated.
Verification
Use repo-native checks first, then add Tauri-specific validation:
cargo fmt --all --check
cargo test --manifest-path src-tauri/Cargo.toml --all-targets
cargo clippy --manifest-path src-tauri/Cargo.toml --all-targets --all-features -- -D warnings
For command changes, add Rust tests around service behavior and frontend tests or contract fixtures for IPC shapes when the app already has a frontend test lane.