Desktop applications

From bobmatnyc/claude-mpm-skills · View interactive version

Desktop applications is an AI agent skill from the GitHub repository bobmatnyc/claude-mpm-skills. Build cross-platform desktop applications with Rust using Tauri framework and native GUI alternatives

How to use this skill

Skill file

Rust Desktop Applications

Overview

Rust has emerged as a premier language for building desktop applications that combine native performance with memory safety. The ecosystem offers two main approaches: Tauri for hybrid web UI + Rust backend apps (think Electron but 10x smaller and faster), and native GUI frameworks like egui, iced, and slint for pure Rust interfaces.

Tauri has revolutionized desktop development by enabling developers to use web technologies (React, Vue, Svelte) for the frontend while leveraging Rust's performance and safety for system-level operations. With bundle sizes under 5MB and memory usage 1/10th of Electron, Tauri apps deliver desktop-class performance. Native frameworks shine for specialized use cases: egui for immediate-mode tools and game editors, iced for Elm-style reactive apps, slint for embedded and declarative UIs.

This skill covers the complete Rust desktop development lifecycle from framework selection through architecture, state management, platform integration, and deployment. You'll build production-ready applications with proper IPC patterns, async runtime integration, native system access, and cross-platform distribution.

When to Use This Skill

Activate when building desktop applications that need native performance, small bundle sizes, system integration, or memory safety guarantees. Specifically use when:

Don't Use When

The Iron Law

TAURI FOR WEB UI + RUST BACKEND | NATIVE GUI FOR PURE RUST | NEVER MIX BUSINESS LOGIC IN FRONTEND

Duplicating logic between frontend and backend, or bypassing IPC for direct access, violates architecture.

Core Principles

  1. Framework Alignment: Tauri for web-skilled teams, native GUI for Rust-first projects
  2. Clear Separation: Frontend handles UI, Rust backend handles business logic and system access
  3. Type-Safe IPC: Commands and events strongly typed with serde serialization
  4. Async Runtime: Tokio for backend concurrency, prevent blocking main thread
  5. Security First: Validate all IPC inputs, minimize exposed commands, CSP policies
  6. Platform Abstraction: Write once, handle platform differences gracefully

Quick Start

  1. Choose Your Framework
  1. Initialize Project

```bash

# Tauri

cargo create-tauri-app my-app

# Select: npm, React/Vue/Svelte, TypeScript

# Native (egui example)

cargo new my-app

cargo add eframe egui

```

  1. Setup Architecture
  1. Implement Core Features
  1. Add Platform Integration
  1. Build and Distribute

```bash

# Development

cargo tauri dev # or cargo run

# Production build

cargo tauri build # Creates installers for current platform

# Cross-platform: Use GitHub Actions with matrix builds

```

Framework Decision Tree

Need desktop app?
├─ Have web frontend skills (React/Vue/Svelte)?
│  └─ YES → Use Tauri
│     ├─ Need <5MB bundles? ✓
│     ├─ System integration? ✓
│     ├─ Cross-platform? ✓
│     └─ Rapid UI development? ✓
│
└─ Pure Rust, no web frontend?
   ├─ Game editor or immediate mode tools? → egui
   ├─ Elm-style reactive architecture? → iced
   ├─ Declarative UI, embedded devices? → slint
   └─ Data-first reactive? → druid

Tauri when: Web UI expertise, need modern frontend frameworks, rapid iteration

Native when: Maximum performance, no web dependencies, specialized UI patterns

Navigation

Detailed guides available:

Key Patterns

Correct Tauri Pattern:

✅ Commands in Rust backend
✅ Type-safe IPC with serde
✅ Async operations with Tokio
✅ State management with Arc<Mutex<T>>
✅ Error propagation with Result<T, E>
✅ Frontend calls backend via invoke()

Correct Native GUI Pattern:

✅ Immediate mode (egui) or retained mode (iced)
✅ State updates trigger redraws
✅ Event handling in Rust
✅ Platform-agnostic rendering
✅ Resource cleanup on drop

Incorrect Patterns:

❌ Business logic in frontend JavaScript
❌ Exposing unsafe commands without validation
❌ Blocking operations on main thread
❌ Direct filesystem access from frontend
❌ Missing error handling on IPC
❌ Hardcoded platform-specific paths

Red Flags - STOP

Integration with Other Skills

Real-World Impact

Performance Metrics:

Production Examples:

The Bottom Line

Rust desktop development offers unmatched performance with memory safety.

Choose Tauri for web UI + Rust backend with tiny bundles. Choose native GUI for pure Rust with specialized patterns. Architect with clear frontend/backend separation. Use type-safe IPC. Integrate Tokio for async. Handle platform differences. Test cross-platform early.

This is the Rust desktop way.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.