tauri-dev
Tauri desktop application development patterns. Use when building the SpecFlux desktop app, implementing IPC communication between Rust and React, managing windows, or testing Tauri commands.
When & Why to Use This Skill
This Claude skill provides standardized patterns and best practices for Tauri desktop application development. It streamlines the integration between Rust backends and React frontends, offering optimized architectural templates for IPC communication, programmatic window management, and robust testing strategies to accelerate the delivery of high-performance cross-platform desktop apps.
Use Cases
- Implementing type-safe IPC communication: Establishing secure and reliable data exchange between Rust commands and React/TypeScript frontend components.
- Dynamic Window Management: Programmatically creating, configuring, and controlling multiple application windows to handle complex desktop UI workflows.
- Automated Testing for Tauri Commands: Setting up unit tests using mock IPC environments to validate backend logic and command execution without requiring a full GUI.
| name | tauri-dev |
|---|---|
| description | Tauri desktop application development patterns. Use when building the SpecFlux desktop app, implementing IPC communication between Rust and React, managing windows, or testing Tauri commands. |
Tauri Development Patterns
IPC Communication
Always define IPC commands with TypeScript types:
// src-tauri/src/main.rs
#[tauri::command]
fn start_agent(task_id: i32) -> Result<(), String> {
// Implementation
Ok(())
}
// frontend/src/api/tauri.ts
import { invoke } from '@tauri-apps/api/tauri';
export async function startAgent(taskId: number): Promise<void> {
await invoke('start_agent', { taskId });
}
Window Management
Create windows programmatically:
import { WebviewWindow } from '@tauri-apps/api/window';
const taskWindow = new WebviewWindow('task-detail', {
url: '/task/42',
title: 'Task #42',
width: 800,
height: 600
});
Testing Tauri Commands
// tests/tauri.test.ts
import { mockIPC } from '@tauri-apps/api/mocks';
describe('Tauri IPC', () => {
beforeEach(() => {
mockIPC((cmd, args) => {
if (cmd === 'start_agent') {
return Promise.resolve();
}
});
});
test('starts agent', async () => {
await expect(startAgent(42)).resolves.toBeUndefined();
});
});