rust-tauri-backend
Implement or modify VMark's Rust/Tauri v2 backend and its frontend bridge - Tauri commands, invoke/emit/listen IPC, menu items and accelerators, Tauri plugins and capabilities, windows, filesystem and platform behaviour in src-tauri. Use for any change under src-tauri/ or to a webview-to-Rust bridge.
How do I install this agent skill?
npx skills add https://github.com/xiaolai/vmark --skill rust-tauri-backendIs this agent skill safe to install?
- Gen Agent Trust Hubpass
The skill is safe. It provides developer instructions and a helper script for searching Tauri/Rust codebases. No malicious activity detected.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
- Runlayerwarn
3/3 files flagged
What does this agent skill do?
Rust + Tauri Backend (VMark)
VMark-specific conventions only; general Tauri v2 API questions go to the
official docs (v2.tauri.app), not memory. The binding rules are in AGENTS.md
and .claude/rules/50-codebase-conventions.md §10; this skill is the
checklist that applies them.
Bridge direction
| Direction | Mechanism | Frontend side |
|---|---|---|
| Webview → Rust | invoke("name", args) → #[tauri::command] fn name | src/services/ (never from src/utils/, which is leaf-pure) |
| Rust → webview | app.emit() / window.emit() | listen() in a hook or service, with cleanup on unmount |
| Menu → webview | menu/events.rs emits menu:{id} generically | a menu:{id} listener |
Adding a command
- Put it in
src-tauri/src/<feature>/commands.rs; register it in theall_commands!list insrc-tauri/src/command_registry.rs.pnpm lint:ipc-contractfails on anyinvoke("x")without a registeredx. - Return
Result<T, CommandError>(command_error.rs); user-facing messages uselocalized_error!with a key in all tensrc-tauri/locales/*.yml(pnpm lint:command-errors). The frontend renders withcommandErrorMessage, neverString(e). - A command that creates a window MUST be
async(pnpm lint:window-thread; WebView2 deadlocks otherwise). Going async removes the serialization the blocking IPC loop gave you — re-check for check-then-act races. - State lives in
.manage()and is reached throughState<'_, T>; no mutablestaticwhere anAppHandlecan reach. - Never a bare
Command::new("tool"): useai_provider::build_command()andai_provider::login_shell_path(). - Use inline format args:
format!("{variable}").
Menus and shortcuts
menu/localized.rscreate_localized_menuis the single builder; labels go insrc-tauri/locales/en.yml(then all locales).- Every menu item needs a real SF Symbol in
MENU_ICONS(src-tauri/src/macos_menu_icons.rs). - Shortcut changes follow the three-file sync in
.claude/rules/41-keyboard-shortcuts.md.
Plugins and capabilities
Add the crate to src-tauri/Cargo.toml, register .plugin() in
src-tauri/src/app_plugins.rs, and grant the narrowest permission in
src-tauri/capabilities/*.json (default.json unless a window-scoped file
fits). cargo machete (lint:rust-deps) runs in CI.
Platform code
macOS is primary; isolate platform code with cfg. Tests using
tauri::test must be gated #[cfg(not(target_os = "windows"))].
Verify
cargo test --manifest-path src-tauri/Cargo.toml
cargo clippy --manifest-path src-tauri/Cargo.toml --all-targets -- -D warnings
bash scripts/check-cross-target.sh # when adding a tauri::test mock-runtime test
pnpm lint:ipc-contract && pnpm lint:command-errors && pnpm lint:window-thread
Find existing bridges with rg -n 'invoke\(|emit\(|listen\(' src src-tauri/src
and commands with rg -n '#\[tauri::command\]' src-tauri/src.
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/xiaolai/vmark/rust-tauri-backend">View rust-tauri-backend on skillZs</a>