tauri-dev

SKILL.md

Tauri v2 Development

Comprehensive development guide for Tauri v2 desktop and mobile applications. Contains 24 rules across 8 categories prioritized by impact, plus 9 deep-dive reference guides. Tauri apps use Rust backends with web frontends rendered in OS-native webviews. Binary sizes 2.5-6 MB.

When to Apply

Reference these guidelines when:

  • Creating new Tauri v2 projects or adding features
  • Implementing Rust commands and frontend IPC
  • Configuring permissions, capabilities, or CSP
  • Installing or creating Tauri plugins
  • Customizing windows, system tray, or menus
  • Building for mobile (Android/iOS)
  • Distributing apps (bundling, signing, updating)
  • Optimizing binary size, build speed, or runtime performance
  • Debugging or testing Tauri applications

Rule Categories by Priority

Priority Category Impact Prefix
1 Commands & IPC CRITICAL ipc-
2 State Management CRITICAL state-
3 Error Handling HIGH error-
4 Security HIGH security-
5 Window Management MEDIUM window-
6 Plugin Usage MEDIUM plugin-
7 Performance MEDIUM perf-
8 Distribution LOW-MEDIUM dist-

Quick Reference

1. Commands & IPC (CRITICAL)

  • ipc-async-commands - Use async commands with owned types (String not &str)
  • ipc-invoke-error-handling - Always handle invoke() rejections on frontend
  • ipc-batch-operations - Batch IPC calls to reduce round-trips
  • ipc-binary-response - Use tauri::ipc::Response for large binary data
  • ipc-channels-streaming - Use Channel for streaming/progress updates

2. State Management (CRITICAL)

  • state-mutex-not-arc - Use Mutex without Arc (Tauri wraps in Arc internally)
  • state-lock-scope - Minimize lock scope, never hold across .await
  • state-rwlock-reads - Use RwLock for read-heavy state

3. Error Handling (HIGH)

  • error-typed-errors - Use thiserror with manual Serialize for structured errors
  • error-frontend-handling - Propagate error context with kind/message to frontend

4. Security (HIGH)

  • security-deny-by-default - Configure capabilities before production deployment
  • security-scope-filesystem - Scope filesystem access to app directories
  • security-platform-capabilities - Use platform-specific capability files
  • security-csp-config - Configure Content Security Policy properly

5. Window Management (MEDIUM)

  • window-async-creation - Create windows asynchronously to avoid deadlocks
  • window-custom-titlebar - Implement custom title bars with drag regions
  • window-hide-to-tray - Hide window to system tray on close

6. Plugin Usage (MEDIUM)

  • plugin-four-step-install - Complete all 4 plugin installation steps
  • plugin-clipboard-permissions - Clipboard has no default permissions
  • plugin-sql-execute - SQL default excludes write operations

7. Performance (MEDIUM)

  • perf-release-profile - Optimize Cargo release profile for small binaries
  • perf-dev-build-speed - Separate rust-analyzer target directory
  • perf-unused-commands - Remove unused commands from binary (Tauri 2.4+)

8. Distribution (LOW-MEDIUM)

  • dist-code-signing - Configure code signing for all target platforms

How to Use

Read individual rule files for detailed explanations and code examples:

rules/ipc-async-commands.md
rules/security-deny-by-default.md
rules/perf-release-profile.md

Each rule file contains:

  • Brief explanation of why it matters
  • Incorrect code example with explanation
  • Correct code example with explanation
  • Impact rating and tags

Deep-Dive References

For comprehensive documentation beyond rules, load these as needed:

Reference Content
references/getting-started.md Prerequisites, project creation, Vite setup, v1→v2 migration
references/commands-ipc.md All command patterns, events, channels, state, serialization
references/plugins.md All ~35 official plugins, custom plugin creation
references/security.md Permissions (TOML), capabilities (JSON), CSP, ACL, isolation
references/windows-webview.md WindowConfig, effects/vibrancy, tray, menus, WebView API
references/mobile.md Android/iOS setup, mobile plugins, signing, app stores
references/distribution.md Bundling, signing, updater, sidecars, CI/CD
references/config-testing.md tauri.conf.json schema, env vars, mockIPC, WebDriver
references/performance.md Binary size, memory, startup, IPC speed, build optimization

Essential Patterns

Project Structure

my-app/
├── src-tauri/
│   ├── Cargo.toml              # Rust dependencies
│   ├── tauri.conf.json         # Main config
│   ├── capabilities/           # ACL capability files (JSON)
│   │   └── default.json
│   ├── src/
│   │   ├── lib.rs              # Builder, plugins, commands
│   │   └── main.rs             # Entry point
│   └── icons/
├── src/                        # Frontend (React/Vue/Svelte)
├── package.json
└── vite.config.ts

Minimal Command + Invoke

#[tauri::command]
async fn greet(name: String) -> Result<String, String> {
    Ok(format!("Hello, {}!", name))
}

// lib.rs
tauri::Builder::default()
    .invoke_handler(tauri::generate_handler![greet])
    .run(tauri::generate_context!())
import { invoke } from '@tauri-apps/api/core';
const greeting = await invoke<string>('greet', { name: 'World' });

Plugin Installation (4 Steps)

cargo add tauri-plugin-fs --manifest-path src-tauri/Cargo.toml
bun add @tauri-apps/plugin-fs
// lib.rs
tauri::Builder::default().plugin(tauri_plugin_fs::init())
// capabilities/default.json → permissions array
"fs:default", "fs:allow-read-text-file"

Capability File

{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "default",
  "windows": ["main"],
  "permissions": [
    "core:default",
    "fs:default",
    { "identifier": "fs:scope", "allow": [{ "path": "$APPDATA/**" }] }
  ]
}

Decision Tables

IPC Method

Need Use
Request/response Command (invoke)
Notify frontend Event (emit)
Stream data Channel (Channel<T>)
Large binary tauri::ipc::Response

State Wrapper

Pattern Use
Read-heavy RwLock<T>
Balanced Mutex<T>
Across .await tokio::sync::Mutex<T>

Full Compiled Document

For the complete guide with all rules expanded: AGENTS.md

Weekly Installs
3
First Seen
Feb 24, 2026
Installed on
gemini-cli3
codex3
cursor3
opencode3
qoder2
codebuddy2