desktop-tauri
Use when the user asks to build a desktop app with Tauri and a Rust backend, Tauri v2, commands and invoke, capabilities and permissions, Tauri plugins, the…
от j4flmao★ 47 звёзд на GitHub
Установить desktop-tauri в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Tauri 2 Desktop Development
Purpose
Tauri builds desktop (Windows, macOS, Linux) and mobile (iOS, Android) apps from a web frontend rendered in the OS webview (WebView2, WKWebView, WebKitGTK) and a Rust core. Tauri 2 replaced the v1 allowlist with a capability/permission system: the frontend can call nothing unless a capability grants it. This skill produces secure command, permission and plugin setups.
Agent Protocol
Trigger
"tauri", "src-tauri", "#[tauri::command]", "invoke", "capabilities", "permissions", "tauri plugin", "tauri updater", "tauri.conf.json".
Input Context
- Tauri major version (
tauricrate insrc-tauri/Cargo.toml,@tauri-apps/apiin package.json). - Frontend framework and bundler; target platforms (desktop/mobile).
- Native capabilities needed (fs, shell, dialogs, notifications, updater).
Output Artifact
Rust commands, lib.rs builder setup, capability JSON, frontend IPC wrappers.
Response Format
Command: {name}({args}) -> Result<{T}, {Error}>
Permission: {capability file} grants {plugin:permission | allow-<command>}
Frontend: invoke<{T}>('{name}', { ... })
Windows/webviews: {labels}
Risk: {what the frontend can now do}
Project Layout (v2)
src-tauri/
Cargo.toml
tauri.conf.json # app identifier, windows, bundle, security.csp
capabilities/default.json# which windows get which permissions
src/main.rs # desktop entry: calls app_lib::run()
src/lib.rs # shared entry for desktop + mobile
Commands (Rust)
// src-tauri/src/lib.rs
use serde::Serialize;
use std::sync::Mutex;
use tauri::State;
#[derive(Debug, thiserror::Error)]
pub enum AppError {
#[error("note title must not be empty")]
EmptyTitle,
#[error(transparent)]
Io(#[from] std::io::Error),
}
// Errors must be serializable to reach the frontend.
impl Serialize for AppError {
fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
s.serialize_str(&self.to_string())
}
}
#[derive(Default)]
struct Notes(Mutex<Vec<String>>);
#[tauri::command]
fn add_note(title: String, notes: State<'_, Notes>) -> Result<usize, AppError> {
let title = title.trim();
if title.is_empty() {
return Err(AppError::EmptyTitle);
}
let mut list = notes.0.lock().expect("notes mutex poisoned");
list.push(title.to_owned());
Ok(list.len())
}
#[tauri::command]
async fn read_config(app: tauri::AppHandle) -> Result<String, AppError> {
use tauri::Manager;
let dir = app.path().app_config_dir().map_err(|e| std::io::Error::other(e.to_string()))?;
Ok(tokio::fs::read_to_string(dir.join("config.json")).await?)
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_dialog::init())
.manage(Notes::default())
.invoke_handler(tauri::generate_handler![add_note, read_config])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
Rules: async commands run on the async runtime (use them for I/O); sync commands run on the main thread unless declared async. Async commands cannot take borrowed args like &str (use String). Command arguments are camelCase on the JS side by default (#[tauri::command(rename_all = "snake_case")] to change).
Frontend IPC
// v2 path is @tauri-apps/api/core (v1 used @tauri-apps/api/tauri)
import { invoke } from '@tauri-apps/api/core';
export async function addNote(title: string): Promise<number> {
try {
return await invoke<number>('add_note', { title });
} catch (err) {
throw new Error(`add_note failed for title "${title}": ${String(err)}`);
}
}
Capabilities & Permissions
// src-tauri/capabilities/default.json
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "Main window permissions",
"windows": ["main"],
"permissions": [
"core:default",
"dialog:allow-open",
"fs:allow-read-text-file",
{ "identifier": "fs:scope", "allow": [{ "path": "$APPDATA/**" }] }
]
}
- Plugin APIs are denied until a permission is listed. Grant the narrowest
allow-*permission, not*:default, when only one call is needed. - Scope file-system and shell permissions to explicit paths/programs.
- Give remote or less-trusted windows a separate capability with fewer permissions;
remote.urlslets a capability apply to remote origins — avoid unless necessary. - App-defined commands are allowed for all windows by default; to restrict them, define permissions in
src-tauri/permissions/and list commands in the build script (tauri_build::Attributes/ app manifest).
Events
use tauri::Emitter;
app.emit("download-progress", 42u32)?; // to all listeners
import { listen } from '@tauri-apps/api/event';
const unlisten = await listen<number>('download-progress', (e) => setProgress(e.payload));
// call unlisten() on
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/tauri-advanced.md
- references/tauri-architecture.md
- references/tauri-deployment.md
- references/tauri-fundamentals.md
- references/tauri-setup.md
- references/tauri-vs-electron.md
FAQ
Что делает скилл desktop-tauri?
Use when the user asks to build a desktop app with Tauri and a Rust backend, Tauri v2, commands and invoke, capabilities and permissions, Tauri plugins, the updater or mobile targets. Produces secure Tauri 2 apps with typed IPC, capability files and bundling. Not for Electron apps (use desktop-electron).
Как установить скилл desktop-tauri?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл desktop-tauri запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…