tauri-development
This skill equips you with patterns for Tauri 2.0 desktop development, covering command definition with specta type generation, Rust-React integration, and proper error handling. Learn state management, async best practices, and desktop-specific constraints to avoid common pitfalls like blocking the async runtime or exposing sensitive errors.
Tauri Development guides you through building desktop apps with Rust backends and React frontends using Tauri 2.0 and specta type binding.
AI-generated summary based on this skill's SKILL.md
Install
cacr92/WeReply/tauri-development · repository language: Python
git clone https://github.com/cacr92/WeReply
cp -r WeReply/.claude/skills/tauri-development ~/.claude/skills/tauri-developmentFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I create Tauri commands with Rust?
Tauri-development teaches you to define commands in Rust using the #[tauri::command] macro, which automatically exposes them to your frontend. Pair this with specta for type-safe bindings—specta generates TypeScript types from your Rust function signatures, eliminating manual type duplication. Use proper async/await patterns and avoid blocking the async runtime with long-running operations; offload heavy work to separate threads via tauri::async_runtime or tokio tasks.
What's the best way to call Tauri commands from React?
Tauri-development covers invoking commands from React using the invoke function from @tauri-apps/api/core. Import your generated specta bindings to get full TypeScript type safety on both request and response. Handle Promise rejections gracefully—Tauri commands can fail due to serialization errors, Rust panics, or validation logic. Always wrap invokes in try-catch or .catch() handlers and provide meaningful error feedback to users rather than exposing raw Rust error messages.
How does specta type binding work between Tauri frontend and backend?
Tauri-development explains that specta introspects your Rust command signatures and generates bindings.ts with matching TypeScript types. Run specta's code generator (typically via build script) to sync types automatically. This ensures your React components receive the exact shape your Rust backend returns—catch type mismatches at compile time, not runtime. If bindings.ts isn't generating, verify your #[tauri::command] macros are properly annotated and specta is configured in your Cargo.toml.
How do I debug Tauri frontend-backend communication issues?
Tauri-development recommends enabling Tauri's debug logging via RUST_LOG=tauri=debug and checking browser console for invoke errors. Use the Tauri CLI's dev mode for hot-reload feedback. Verify command names match exactly between Rust definition and React invoke calls. Test serialization by logging both sides—print the Rust value before returning and the JavaScript value after receiving. Check that custom types implement serde::Serialize/Deserialize and that your React payload matches the Rust function signature.
What are Tauri performance optimization and async best practices?
Tauri-development covers using tokio for concurrent operations and avoiding blocking the main async runtime with CPU-intensive work. Spawn heavy tasks on separate threads via tauri::async_runtime::spawn_blocking. Batch multiple command calls into a single invocation when possible to reduce IPC overhead. Implement proper state management with Tauri's State<T> to share resources across commands without re-initializing. Use lazy_static or once_cell for expensive initialization, and profile with flamegraph to identify bottlenecks.
How do I implement desktop-specific features like window management and system tray?
Tauri-development teaches window management via the Window API—create, show, hide, and position windows programmatically from Rust commands or React. System tray integration uses tauri::SystemTray with menu items that trigger commands. Handle file system access through Tauri's fs scope (configure in tauri.conf.json) to enforce security boundaries. Implement input validation in Rust before processing user data, and never expose sensitive errors to the frontend—log them server-side and return generic messages to prevent information leakage.
SKILL.md
rendered from the published skill — quoted content, verbatim
Tauri Development Skill
Expert guidance for Tauri 2.0 desktop application development with Rust backend and React TypeScript frontend.
Overview
This skill provides comprehensive guidance for: - Creating Tauri commands with proper specta type binding - Integrating Rust backend with React TypeScript frontend - Handling desktop-specific patterns and constraints - Optimizing frontend-backend communication - Following Tauri 2.0 best practices
When This Skill Applies
This skill activates when: - Creating or modifying Tauri commands - Setting up specta type bindings - Debugging frontend-backend communication issues - Implementing desktop-specific features - Optimizing Tauri application performance - Handling Tauri-specific error cases
Core Tauri Principles
Command Definition Pattern
All
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 2 files
.claude/skills/tauri-development/SKILL.md
.claude/skills/tauri-development/skill.json