Add Tauri framework development skill

Created comprehensive Tauri skill for building desktop and mobile
applications with Rust backend and web frontend.

Skill Content:
- Complete Tauri 2.0 framework coverage
- Cross-platform development (Windows, macOS, Linux, iOS, Android)
- IPC communication patterns (commands, events, bridges)
- Security best practices (capabilities, permissions, CSP)
- Native API integration (system tray, notifications, file system)
- Build and distribution guidance (code signing, auto-updater)

Files Created:
- skill.md - Main skill with 6 slash commands
- templates/
  - tauri.conf.json - Config template with all options
  - capabilities/default.json - Basic permissions
  - capabilities/fs-full.json - File system access
  - capabilities/network.json - Network permissions
  - src-tauri/commands/mod.rs - Rust command templates
  - src-tauri/events.rs - Event emission examples
- examples/
  - command-invoking.txt - Frontend command patterns
  - event-listening.txt - Event handling patterns
  - plugin-usage.txt - 10+ plugin examples (fs, http, dialog, etc.)
  - mobile-setup.txt - iOS/Android development guide

Slash Commands:
- /tauri-init - Initialize new Tauri project
- /tauri-add-plugin - Add Tauri plugin
- /tauri-build - Build for specific platform
- /tauri-capability - Create permission capability
- /tauri-ipc - Design IPC interface
- /tauri-native - Add native feature

Integration:
- Uses rust-patterns for backend code quality
- Integrates with react-dev, vue, svelte for frontend
- Leverages architecture skill for system design
- Uses test-driven-development for testing

Credits:
- Proper attribution to Tauri Team and The Commons Conservancy
- Links to official documentation and community resources
- Credits core dependencies: WRY, TAO, Tauri CLI

Planned via /brainstorm with comprehensive Ralph-validated design.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
uroma
2026-01-23 18:39:20 +00:00
Unverified
parent cd5c39811d
commit 51ae409ecb
11 changed files with 1359 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
{
"identifier": "default",
"description": "Default capabilities for the application",
"windows": ["main"],
"permissions": [
"core:default",
"core:window:default",
"core:window:allow-center",
"core:window:allow-maximize",
"core:window:allow-minimize",
"core:window:allow-unmaximize",
"core:window:allow-unminimize",
"dialog:default",
"fs:read-file",
"fs:write-file",
"fs:read-dir",
"fs:scope:read-file",
"fs:scope:write-file",
"fs:scope:read-dir",
"http:default",
"notification:default",
"shell:default",
"clipboard-manager:default",
"global-shortcut:default"
]
}

View File

@@ -0,0 +1,24 @@
{
"identifier": "fs-full",
"description": "Full file system access - use with caution",
"windows": ["main"],
"permissions": [
"fs:read-file",
"fs:write-file",
"fs:read-dir",
"fs:copy-file",
"fs:remove",
"fs:rename",
"fs:exists",
"fs:scope:read-file",
"fs:scope:write-file",
"fs:scope:read-dir",
"fs:scope:copy-file",
"fs:scope:remove",
"fs:scope:rename",
"fs:scope:exists",
"path:default",
"path:resolve",
"path:resolve-directory"
]
}

View File

@@ -0,0 +1,21 @@
{
"identifier": "network-full",
"description": "Full network access capabilities",
"windows": ["main"],
"permissions": [
"http:default",
"http:allow-fetch",
"http:allow-fetch-cancel",
"http:allow-fetch-read-body",
"http:allow-fetch-send",
"http:allow-request",
"http:allow-fetch-delete",
"http:allow-fetch-post",
"http:allow-fetch-put",
"http:allow-fetch-patch",
"http:allow-fetch-head",
"http:allow-fetch-options",
"http:allow-fetch-connect",
"http:allow-fetch-trace"
]
}

View File

@@ -0,0 +1,63 @@
// Tauri Commands Module
// This module contains all the commands exposed to the frontend
use serde::{Deserialize, Serialize};
/// Common result type for commands
pub type CommandResult<T> = Result<T, String>;
/// Example payload structure
#[derive(Debug, Serialize, Deserialize)]
pub struct ExamplePayload {
pub data: String,
pub count: i32,
}
// Basic example command
#[tauri::command]
pub fn greet(name: &str) -> CommandResult<String> {
Ok(format!("Hello, {}! From Rust backend!", name))
}
// Example with structured payload
#[tauri::command]
pub fn process_data(payload: ExamplePayload) -> CommandResult<String> {
Ok(format!("Processed: {} (count: {})", payload.data, payload.count))
}
// Async command example
#[tauri::command]
pub async fn async_operation(input: String) -> CommandResult<String> {
// Simulate async work
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
Ok(format!("Async result from: {}", input))
}
// Error handling example
#[tauri::command]
pub fn command_with_error(should_fail: bool) -> CommandResult<String> {
if should_fail {
Err("This command failed as requested".to_string())
} else {
Ok("Command succeeded!".to_string())
}
}
// Complex command with multiple parameters
#[tauri::command]
pub fn complex_command(
text: String,
number: i32,
flag: bool,
) -> CommandResult<String> {
Ok(format!(
"Text: {}, Number: {}, Flag: {}",
text, number, flag
))
}
// Export all commands
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
// This function is called on mobile platforms
}

View File

@@ -0,0 +1,70 @@
// Tauri Events Module
// This module demonstrates event emission from Rust to the frontend
use serde::{Deserialize, Serialize};
use tauri::{Emitter, EmitterExt};
/// Example event payload
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ProgressEvent {
pub current: u32,
pub total: u32,
pub message: String,
}
/// Emit a progress event
pub fn emit_progress(app: &tauri::AppHandle, current: u32, total: u32, message: &str) -> tauri::Result<()> {
app.emit("progress", ProgressEvent {
current,
total,
message: message.to_string(),
})
}
/// Emit a data update event
pub fn emit_data_update(app: &tauri::AppHandle, data: &str) -> tauri::Result<()> {
#[derive(Serialize)]
struct DataUpdate {
data: String,
timestamp: u64,
}
app.emit("data-update", DataUpdate {
data: data.to_string(),
timestamp: std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap()
.as_secs(),
})
}
/// Emit an error event
pub fn emit_error(app: &tauri::AppHandle, error: &str) -> tauri::Result<()> {
#[derive(Serialize)]
struct ErrorEvent {
error: String,
timestamp: u64,
}
app.emit("error", ErrorEvent {
error: error.to_string(),
timestamp: std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap()
.as_secs(),
})
}
/// Emit a notification event
pub fn emit_notification(app: &tauri::AppHandle, title: &str, body: &str) -> tauri::Result<()> {
#[derive(Serialize)]
struct NotificationEvent {
title: String,
body: String,
}
app.emit("notification", NotificationEvent {
title: title.to_string(),
body: body.to_string(),
})
}

View File

@@ -0,0 +1,63 @@
{
"$schema": "https://schema.tauri.app/config/2.0.0",
"productName": "My Tauri App",
"version": "1.0.0",
"identifier": "com.example.my-tauri-app",
"build": {
"beforeDevCommand": "npm run dev",
"beforeBuildCommand": "npm run build",
"frontendDist": "../dist",
"withGlobalTauri": true
},
"app": {
"windows": [
{
"title": "My Tauri App",
"width": 1200,
"height": 800,
"resizable": true,
"fullscreen": false,
"center": true,
"decorations": true,
"transparent": false,
"alwaysOnTop": false,
"skipTaskbar": false
}
],
"security": {
"csp": null,
"dangerousDisableAssetCspModification": false
}
},
"bundle": {
"active": true,
"targets": ["dmg", "msi", "appimage", "deb"],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
],
"publisher": "Example Publisher",
"copyright": "",
"category": "Productivity",
"shortDescription": "My amazing Tauri application",
"longDescription": "A comprehensive desktop application built with Tauri",
"macOS": {
"frameworks": [],
"minimumSystemVersion": "10.15",
"exceptionDomain": "",
"signingIdentity": null,
"entitlements": null,
"providerShortName": null,
"standalone": false
},
"windows": {
"certificateThumbprint": null,
"digestAlgorithm": "sha256",
"timestampUrl": ""
}
},
"plugins": {}
}