agentleFS
PiloTracerPiloTracer/pilo.ai.logicbison/skills/tauri-development/skill.md

tauri-development

Skill0 starsChanged 5 months agoMITView on GitHub

Domain guidance for building tiny, fast, and secure desktop applications with the Tauri framework (v1 / v2). Covers Rust backend patterns, IPC security, webview shell strategy, state management, event handling, and project-specific patterns like Docker-backed webview redirection and API bridge servers. Pairs with dev-stack when the Tauri app manages a Docker Compose dev stack. Use when the task involves Tauri APIs, Rust commands, webview configuration, IPC commands, or Tauri project structure.

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. 0 are common, 3 are distinctive, and 12 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 12

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Security first: Only enable specific Tauri APIs required for the task in tauri.conf.json / capabilities.

    line 29
  2. Very specific:

    No secrets in Rust commands or webview: Use environment variables or OS-level secure storage (e.g., keyring).

    line 32
  3. Distinctive:

    Shell strategy preferred: When the Tauri app wraps a Docker/local web service, prefer webview redirection over iframe embedding.

    line 33
  4. Very specific:

    Full-duplex events for async state: Use emit and listen for asynchronous updates (e.g., Docker container status, long-running task …

    line 34
  5. Very specific:

    Operator handoff: every response that ends a turn follows the Operator handoff contract — terse output.

    line 36
  6. Very specific:

    Use strongly typed #[tauri::command] with serde::Serialize/Deserialize for all arguments and return types.

    line 44
  7. Very specific:

    Use Tauri's AppHandle / State for shared managed state — never raw statics or unsafe.

    line 46
  8. Very specific:

    Use tauri::scope for filesystem and shell access restrictions.

    line 52
  9. Very specific:

    Use app.manage(MyState { ...

    line 58
  10. Very specific:

    Use setup hook for async initialization (e.g., start an embedded HTTP server, verify Docker stack).

    line 59
  11. Very specific:

    Use Arc/Mutex or RwLock for mutable shared state.

    line 61
  12. Distinctive:

    When a Tauri app needs to serve files or APIs to co-located Docker containers:

    line 65
  13. Distinctive:

    Use UUID-based path authorization: folder grant → UUID → container requests by UUID, never absolute host paths.

    line 68
  14. Very specific:

    Use @tauri-apps/api (v1) or @tauri-apps/api v2 packages for IPC calls from frontend.

    line 74
  15. Very specific:

    Prefer webview redirection to a local web service over embedding <iframe> when the Tauri app acts as a shell.

    line 77

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
skill.md

tauri-development

Domain guidance for Tauri desktop development. This skill is read-only reference — it does not execute file mutations. It provides architectural principles, security patterns, and project conventions for AI agents working with Tauri projects.

Tool-agnostic (Cursor, Claude Code, opencode, Codex). Requires: a Tauri project with src-tauri/ directory.

Pairs with: dev-stack (Docker Compose orchestration when Tauri wraps a containerized backend), code-implementation (execution), code-verify (verification).

Registry: .ai/skills/SKILL_DEPENDENCIES.md.

Canonical path: .ai/skills/tauri-development/skill.md · Invocation examples: reference.md


Hard rules

  • Security first. Only enable specific Tauri APIs required for the task in tauri.conf.json / capabilities. Validate all IPC payloads in Rust — never trust the frontend.
  • Heavy lifting in Rust. Move ALL file system access, system integration, and performance-critical computation to the src-tauri layer.
  • Type safety across the bridge. Provide corresponding TypeScript interfaces for all Rust structs used in #[tauri::command] functions.
  • No secrets in Rust commands or webview. Use environment variables or OS-level secure storage (e.g., keyring). Never log or expose tokens via IPC events.
  • Shell strategy preferred. When the Tauri app wraps a Docker/local web service, prefer webview redirection over iframe embedding. Use iframes only when strict DOM isolation is required.
  • Full-duplex events for async state. Use emit and listen for asynchronous updates (e.g., Docker container status, long-running task progress). Do not poll.
  • Binary size discipline. Strip debug symbols in release builds. Leverage the system webview (WebKit/WebView2) instead of bundling Chromium.
  • Operator handoff: every response that ends a turn follows the Operator handoff contract — terse output; approvals under **Needs your approval:** citing path:L<n>; questions numbered under **Needs your answer:**; exactly one **Next step:** command; one line when nothing is needed (Form A). Decisions and questions never mixed; empty sections omitted.

Guidance areas

1. IPC & commands

  • Use strongly typed #[tauri::command] with serde::Serialize/Deserialize for all arguments and return types.
  • Return Result<T, E> where E: impl Into<InvokeError> for error propagation to the frontend.
  • Use Tauri's AppHandle / State for shared managed state — never raw statics or unsafe.
  • For Tauri v2: use tauri::Emitter trait for emitting events, tauri::Listener / tauri::listen for receiving.

2. Security capabilities (Tauri v2)

  • Declare capabilities in src-tauri/capabilities/. Enable only the minimum required permissions.
  • Use tauri::scope for filesystem and shell access restrictions.
  • Disable unused Tauri APIs. Every enabled API is an attack surface vector.
  • For dialog/file-system APIs: open native dialogs from Rust commands, not from frontend JS.

3. State management & lifecycle

  • Use app.manage(MyState { ... }) to inject shared state (DB connections, config, HTTP clients) during setup.
  • Use setup hook for async initialization (e.g., start an embedded HTTP server, verify Docker stack).
  • Access managed state in commands via State<'_, MyState> parameter.
  • Use Arc/Mutex or RwLock for mutable shared state; prefer tokio::sync types in async contexts.

4. HTTP server in Tauri (bridge pattern)

When a Tauri app needs to serve files or APIs to co-located Docker containers:

  • Embed a lightweight HTTP server (Axum 0.7 / Actix) spawned during setup on a dedicated port.
  • Bind to 127.0.0.1 — never 0.0.0.0 — to prevent LAN exposure.
  • Use UUID-based path authorization: folder grant → UUID → container requests by UUID, never absolute host paths.
  • Enforce path traversal protection: canonicalize(full_path).starts_with(base_path) on every request.
  • Docker containers reach the host via host.docker.internal:<port>.

5. Frontend integration

  • Use @tauri-apps/api (v1) or @tauri-apps/api v2 packages for IPC calls from frontend.
  • For Tauri v2: use import { invoke } from '@tauri-apps/api/core'.
  • Listen to events with import { listen } from '@tauri-apps/api/event' (v2).
  • Prefer webview redirection to a local web service over embedding <iframe> when the Tauri app acts as a shell.

Parse invocation

User saysVerbAction
@tauri-developmenthelpDisplay guidance overview and link to reference.md
@tauri-development statusstatusRead-only: check Tauri project structure, config, and capabilities
@tauri-development helphelpPoint to purpose and reference

Non-mutating — no init/create/start/continue/complete modes.


Self-verify note

This is a read-only reference skill. It does not produce artifacts that need verification. When an agent applies Tauri guidance during code-implementation, the standard code gates (tests/lint/type-check) apply per that skill.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.