Skip to content

full-stack-skills/tauri-skills / skills/tauri-app-planning

tauri-app-planning

Verified

Comprehensive project planning, requirements analysis, and architectural orchestration for Tauri 2.0 applications.

FileKindSize
LICENSE.txtmarkdown11.1 KB
SKILL.mdskill md1.4 KB
agents/openai.yamlconfig322 B
examples/architecture-patterns.mdmarkdown2.7 KB
examples/usage.mdmarkdown966 B
templates/project-plan.mdmarkdown1.4 KB
templates/todo-list.mdmarkdown825 B

examples/architecture-patterns.md

View on GitHub
# Tauri Orchestration Patterns

## Goal
Manage complex applications with multiple windows, shared state, and event-driven communication.

## Core Concepts

1.  **Window Management**: Opening, closing, and hiding windows programmatically.
2.  **Event System**: `emit` and `listen` for Global vs Window-specific events.
3.  **State Management**: Using `Manager::manage` in Rust to hold database connections or app state.

## Implementation Patterns

### 1. State Management (Rust)

**Pattern**: Use `tauri::State` to share data between commands.

```rust
use std::sync::Mutex;
use tauri::{Manager, State};

struct AppState {
    counter: Mutex<i32>,
    db_pool: Mutex<Option<String>>, // Mock DB connection
}

#[tauri::command]
fn increment(state: State<AppState>) -> i32 {
    let mut count = state.counter.lock().unwrap();
    *count += 1;
    *count
}

pub fn run() {
    tauri::Builder::default()
        .manage(AppState { 
            counter: Mutex::new(0),
            db_pool: Mutex::new(None)
        })
        .invoke_handler(tauri::generate_handler![increment])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}
```

### 2. Event Communication

**Pattern**: Decoupled communication using events.

**Rust -> Frontend**:
```rust
// Emit to all windows
app.emit("update-status", "processing started");

// Emit to specific window
if let Some(window) = app.get_webview_window("main") {
    window.emit("download-progress", 50);
}
```

**Frontend -> Frontend (Window to Window)**:
```typescript
import { emit, listen } from '@tauri-apps/api/event';

// In Window A (Sender)
await emit('global-event', { message: 'Hello from Window A' });

// In Window B (Receiver)
await listen('global-event', (event) => {
  console.log('Received:', event.payload);
});
```

### 3. Window Management (Frontend)

**Pattern**: Dynamic window creation.

```typescript
import { WebviewWindow } from '@tauri-apps/api/webviewWindow';

async function openSettings() {
  const webview = new WebviewWindow('settings', {
    url: 'settings.html',
    title: 'Settings',
    width: 600,
    height: 400,
    center: true
  });
  
  webview.once('tauri://created', function () {
    console.log('Settings window created');
  });
  
  webview.once('tauri://error', function (e) {
    console.error('Error creating window', e);
  });
}
```

## Best Practices

-   **Minimize Event Payloads**: Large JSON payloads in events can be slow. Use Commands for large data transfer.
-   **Window Labels**: Use consistent naming (e.g., `main`, `settings`, `splash`) for easier targeting in Capabilities.
-   **Graceful Shutdown**: Listen for `tauri://close-requested` to save state before closing.
planning-and-task-breakdownaddyosmani/agent-skillsBreaks work into ordered tasks. Use when you have a spec or clear requirements and need to break work into implementable tasks. Use when a task feels too large to start, when you need to estimate scope, or when parallel work is possible.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
screenpipethedotmack/claude-memSearch screen and audio history recorded by Screenpipe and optionally save selected context into claude-mem. Use when the user asks to recall desktop activity, a meeting, or something seen in another app through Screenpipe.Stars: 118kUpdated Claude CodeCodexVerifiedInstall
contact-widgetnexu-io/open-designSelf-contained floating chat widget with welcome screen, social links, meeting button, and message input. Single HTML file, zero dependencies.Stars: 108kUpdated Claude CodeCodexVerifiedInstall
meeting-notesnexu-io/open-designMeeting notes page — title bar with attendees, agenda checklist, decisions block, action items table with owners + dates, and a "next meeting" footer. Use when the brief mentions "meeting notes", "minutes", "1:1 notes", "all-hands recap", or "会议纪要".Stars: 108kUpdated Claude CodeCodexVerifiedInstall