Skill 详情
tauri
Supports Tauri mobile development but is framework-specific and desktop-oriented.
使用前先检查
自动化审核只检查相关性,不代表安全审查或推荐。使用前请阅读来源中的说明。
SKILL.md
这段内容是审核时保存的快照。外部来源才是完整且最新的版本。
---
name: tauri
description: Tauri framework for building cross-platform desktop and mobile apps. Use for desktop app development, native integrations, Rust backend, and web-based UIs.
---
# Tauri Skill
Comprehensive assistance with Tauri development, generated from official documentation.
## When to Use This Skill
This skill should be triggered when:
- Building cross-platform desktop applications with Rust + WebView
- Implementing native system integrations (file system, notifications, system tray)
- Setting up Tauri project structure and configuration
- Debugging Tauri applications in VS Code or Neovim
- Configuring Windows/macOS/Linux code signing for distribution
- Developing mobile apps with Tauri (Android/iOS)
- Creating Tauri plugins for custom native functionality
- Implementing IPC (Inter-Process Communication) between frontend and backend
- Optimizing Tauri app security and permissions
- Setting up CI/CD pipelines for Tauri app releases
## Key Concepts
### Multi-Process Architecture
Tauri uses a **Core Process** (Rust) and **WebView Process** (HTML/CSS/JS) architecture:
- **Core Process**: Manages windows, system tray, IPC routing, and has full OS access
- **WebView Process**: Renders UI using system WebViews (no bundled browser!)
- **Principle of Least Privilege**: Each process has minimal required permissions
### Inter-Process Communication (IPC)
Two IPC primitives:
- **Events**: Fire-and-forget, one-way messages (both Core → WebView and WebView → Core)
- **Commands**: Request-response pattern using `invoke()` API (WebView → Core only)
### Why Tauri?
- **Small binaries**: Uses OS WebViews (Microsoft Edge WebView2/WKWebView/webkitgtk)
- **Security-first**: Message passing architecture prevents direct function access
- **Multi-platform**: Desktop (Windows/macOS/Linux) + Mobile (Android/iOS)
## Quick Reference
### 1. Project Setup - Cargo.toml
```toml
[build-dependencies]
tauri-build = "2.0.0"
[dependencies]
tauri = { version = "2.0.0" }
```
### 2. Windows Code Signing Configuration
```json
{
"tauri": {
"bundle": {
"windows": {
"certificateThumbprint": "A1B1A2B2A3B3A4B4A5B5A6B6A7B7A8B8A9B9A0B0",
"digestAlgorithm": "sha256",
"timestampUrl": "http://timestamp.comodoca.com"
}
}
}
}
```
### 3. VS Code Debugging - launch.json
```json
{
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Tauri Development Debug",
"cargo": {
"args": [
"build",
"--manifest-path=./src-tauri/Cargo.toml",
"--no-default-features"
]
},
"preLaunchTask": "ui:dev"
}
]
}
```
### 4. Rust State Management
```rust
let data = app.state::<AppData>();
```
### 5. GitHub Actions - Publish Workflow
```yaml
name: 'publish'
on:
push:
tags:
- 'app-v*'
```
### 6. Trunk Configuration (Rust Frontend)
```toml
# Trunk.toml
[watch]
ignore = ["./src-tauri"]
[serve]
ws_protocol = "ws"
```
### 7. Azure Key Vault Signing (relic.conf)
```toml
[server.azurekv]
url = "https://<KEY_VAULT_NAME>.vault.azure.net/certificates/<CERTIFICATE_NAME>"
```
### 8. Custom Sign Command (tauri.conf.json)
```json
{
"tauri": {
"bundle": {
"windows": {
"signCommand": "relic sign -c relic.conf -f -o \"%1\""
}
}
}
}
```
### 9. Opening DevTools Programmatically
```rust
use tauri::Manager;
#[tauri::command]
fn open_devtools(window: tauri::Window) {
window.open_devtools();
}
```
### 10. Mobile Plugin - Android Command
```kotlin
@Command
fun download(invoke: Invoke) {
val args = invoke.parseArgs(DownloadArgs::class.java)
// Command implementation
invoke.resolve()
}
```
## Reference Files
This skill includes comprehensive documentation organized into 9 categories:
### core_concepts.md
**Contains:** 7 pages covering foundational architecture
- **Process Model**: Multi-process architecture, Core vs WebView processes, security princi在 GitHub 阅读完整来源 (打开外部页面)