Provides utilities for cross-platform file operations and path management within Tauri applications.
Install
mkdir -p .claude/skills/tauri && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/1784" && unzip -o skill.zip -d .claude/skills/tauri && rm skill.zipInstalls to .claude/skills/tauri
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Tauri commands, permissions, capabilities, security config, path handling, cross-platform file ops, and native filesystem APIs. Use when mentioning Tauri, desktop apps, Rust commands, invoke, capabilities, permissions, ResourceId, file paths, or platform differences.Key capabilities
- →Resolve platform-specific file paths
- →Configure security capabilities and CSP policies
- →Generate typed IPC bindings for Rust-frontend communication
- →Manage filesystem operations using Tauri plugins
- →Implement secure command handlers with input validation
How it works
It provides path manipulation utilities that handle OS-specific separators and enforces security boundaries by requiring explicit capability definitions and typed IPC command registration.
Inputs & outputs
When to use tauri
- →Access filesystem paths in Tauri apps
- →Implement cross-platform file operations
- →Manage frontend-to-backend file API calls
- →Resolve OS path inconsistencies
About this skill
Tauri Patterns
Reference Repositories
- Tauri: Desktop app framework with Rust backend and web frontend
Upstream Grounding
When Tauri command behavior, permissions, capabilities, CSP, asset protocols, path APIs, plugin filesystem behavior, or IPC semantics affect correctness, use source-backed grounding before relying on memory. If DeepWiki MCP is available, ask a narrow question against tauri-apps/tauri; if it is unavailable or the repo is not indexed, use upstream source or official docs directly. Treat DeepWiki as orientation, then verify decisive details against local generated bindings, installed Rust crates, TypeScript types, source, or official docs before changing code.
Skip DeepWiki for repo-local command naming and app-specific wrapper conventions already visible in the code.
Commands, Permissions, And Security
- Expose focused Rust APIs with
#[tauri::command], register them withgenerate_handler!, and returnResult<T, E>for fallible work. - Validate command inputs on the Rust side. TypeScript callers are not the trust boundary.
- Keep capabilities least-privilege in
app.security.capabilities, scoped to the windows or webviews that need them. Avoid broad permission wildcards. Current Epicenter capabilities grant commands by window label; keep command registrations and the relevant capability grants consistent. - Treat CSP,
devCsp, asset protocol configuration,convertFileSrc,freezePrototype, and remote IPC as security-sensitive config. - Long-lived Rust objects should be Tauri resources with frontend
ResourceIds. Do not serialize complex long-lived objects through command responses.
Webview CSP
Never ship app.security.csp: null (that disables CSP entirely). The
highest-value directive is connect-src: locking it to your API origin plus
Tauri's IPC blocks an injected same-origin script from exfiltrating in-memory
secrets (tokens, keys) to an attacker host. Start from a narrow policy, then
add only the sources your app actually uses, for example asset protocols, wasm,
workers, media, or dev server origins. Set both csp (production) and devCsp
(the dev override, which replaces csp during tauri dev):
"security": {
// Tauri's tauri-codegen hashes every inline <script> in the built
// frontendDist and injects the hashes, so production script-src does NOT
// need 'unsafe-inline' (a SvelteKit SPA still boots via its hash).
"csp": "default-src 'self'; connect-src 'self' ipc: http://ipc.localhost https://api.example.com wss://api.example.com; img-src 'self' data: blob: https:; style-src 'self' 'unsafe-inline'; script-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'",
// Dev loads from the Vite server (not the hashed build), so its inline/HMR
// scripts ARE unhashed: devCsp must keep 'unsafe-inline' (+ 'unsafe-eval')
// and add the localhost dev origins.
"devCsp": "default-src 'self'; connect-src 'self' ipc: http://ipc.localhost http://localhost:5173 ws://localhost:5173 https://api.example.com wss://api.example.com; img-src 'self' data: blob: https:; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; object-src 'none'; base-uri 'self'"
}
Rules: always include ipc: http://ipc.localhost in connect-src or invoke()
breaks; only list asset: / http://asset.localhost if the asset protocol is
actually enabled (convertFileSrc); always smoke-test a real tauri dev AND a
release build, watching the webview console for CSP violations.
Typed IPC And Generated Bindings
When a Tauri app uses tauri-specta, keep the Rust command registry, generated TypeScript bindings, and handwritten frontend wrapper in sync.
- Register every typed command in the
tauri_specta::collect_commands!builder. - Register frontend-listened event payloads in
tauri_specta::collect_events!, even when no command returns that event type. - For tauri-specta v2 RC events, use
#[tauri_specta(event_name = "...")]on the event type. Do not invent#[tauri_specta::event(...)]unless installed macro docs or local macro source prove that form exists. - Re-export event and command payload types from their owning Rust module when
lib.rsimports them for the builder. - Treat
bindings.gen.tsas derived output. One builder generates every consumer's copy, so regenerate and review each of them when a command, error, or event changes. Commit regenerated bindings only when the Rust IPC surface intentionally changed. If a command only fixes Rust compile shape without changing the public IPC contract, avoid broad generated churn. - Commands returning raw
tauri::ipc::Responsecannot be generated by specta because the body is notspecta::Type. Mount those through a separatetauri::generate_handler!route and keep a small handwritten TypeScript wrapper.
Rust errors that TypeScript consumes
Define an error variant only when a caller can respond differently or needs structured data; keep operational detail in message. The recorder's PermissionDenied, NoInputDevice, and Busy variants are examples. An internal Rust error that never crosses IPC needs no Serde or Specta derives.
A command error that crosses IPC derives serde::Serialize and specta::Type from one enum, with an internal tag so TypeScript gets a discriminant:
#[derive(Debug, thiserror::Error, serde::Serialize, specta::Type)]
#[serde(tag = "name")]
pub enum RecordingError {
#[error("{message}")]
PermissionDenied { message: String },
}
- Never write a TypeScript union or runtime schema for a generated Rust error. Import the type from
bindings.gen.tswithimport type, which does not load the Tauri runtime. - Keep the error type non-nullable. Specta's
DataErrormode readsnullas success and fails binding export on a nullable error. A success value may be nullable. - The plugins' Specta builders set
ErrorHandlingMode::DataError, so a fallible command returns{ data: T, error: null } | { data: null, error: E }, which matches Wellcrafted'sResult<T, E>. Do not reshape it again in the consumer's command wrapper. Infallible commands keep their plain return type. - Tauri still rejects the IPC call on a Rust
Err. The generated helper casts a non-Errorrejection toEand rethrows a JavaScriptError, so the types are a compile-time contract, not runtime validation. Do not present an unexpected thrown failure as a known variant. - Exhaustive
switch (error.name)is the right handler where a caller translates every variant; regenerating bindings after a variant change surfaces the missing cases. - A returned
Erris not a log event. See theloggingskill for where to log;error-handlingcovers Results after the IPC boundary.
Verification for IPC changes usually needs both sides:
cargo check --manifest-path apps/whispering/src-tauri/Cargo.toml
If binding generation rewrites unrelated sections, inspect the diff before committing it.
Verify in the desktop app
Compile checks and regenerated bindings establish shape. Accept a change to a
command, capability, event, window, menu, dialog, or desktop-only UI in the
running native app: launch it with bun dev:<app>:desktop, exercise the
journey that crosses the change, and watch the webview console and Rust
output. A browser build or a test that mocks invoke does not show the native
side working. Follow
ui-design's verification reference
for what counts, OS-owned surfaces, and reporting a check you could not run.
Context Detection
Before choosing a path API, determine your execution context:
| Context | Location | Correct API |
|---|---|---|
| Tauri frontend | apps/*/src/**/*.ts, apps/*/src/**/*.svelte | @tauri-apps/api/path |
| Node.js/Bun backend | packages/**/*.ts, CLI tools | Node.js path module |
Rule: If the code runs in the browser (Tauri webview), use Tauri's path APIs. If it runs in Node.js/Bun, use the Node.js path module.
Available Functions from @tauri-apps/api/path
Path Manipulation
| Function | Purpose | Example |
|---|---|---|
join(...paths) | Join path segments with platform separator | await join(baseDir, 'workspaces', id) |
dirname(path) | Get parent directory | await dirname('/foo/bar/file.txt') → /foo/bar |
basename(path, ext?) | Get filename, optionally strip extension | await basename('/foo/bar.txt', '.txt') → bar |
extname(path) | Get file extension | await extname('file.txt') → .txt |
normalize(path) | Resolve .. and . segments | await normalize('/foo/bar/../baz') → /foo/baz |
resolve(...paths) | Resolve to absolute path | await resolve('relative', 'path') |
isAbsolute(path) | Check if path is absolute | await isAbsolute('/foo') → true |
Platform Constants
| Function | Purpose | Returns |
|---|---|---|
sep() | Platform path separator | \ on Windows, / on POSIX |
delimiter() | Platform path delimiter | ; on Windows, : on POSIX |
sep() and delimiter() are synchronous in Tauri v2. Most directory and path manipulation helpers are async because they call the backend.
Base Directories
| Function | Purpose
Content truncated.
When not to use it
- →When working on non-Tauri desktop applications
- →When using Node.js path modules for browser-based frontend code
Prerequisites
Limitations
- →Path helpers are asynchronous due to IPC communication
- →Requires manual synchronization of Rust and TypeScript types
How it compares
It replaces manual string concatenation and error-prone path slicing with platform-aware async APIs and enforces strict security through capability-based configuration.
Compared to similar skills
tauri side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| tauri (this skill) | 76 | 4mo | Review | Advanced |
| rust-errors | 5 | 4mo | No flags | Advanced |
| hula-skill | 3 | 10mo | Review | Intermediate |
| waller-wallpaper-session | 0 | 6mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by EpicenterHQ
View all by EpicenterHQ →You might also like
rust-errors
EpicenterHQ
Rust to TypeScript error handling patterns for Tauri apps. Use when defining Rust errors that will be passed to TypeScript, handling Tauri command errors, or creating discriminated union error types.
hula-skill
HuLaSpark
HuLa project skill for frontend (Vue 3 + Vite + UnoCSS + Naive UI/Vant), backend (Tauri v2 + Rust + SeaORM/SQLite), full-stack flows, and build/release work. Use when the user mentions hula or HuLa or requests changes in this repository; after triggering, ask which scope (frontend/backend/fullstack/build-release) to enable.
waller-wallpaper-session
gvastethecreator
Extend or debug the Wallpaper Session, monitor drafts, preview flows, editor flow, and profile composition across React, Tauri, and Rust. Use for monitor wallpaper features, profile bugs, preview issues, or domain-model changes.
tauri-syntax-permissions
OpenAEC-Foundation
>
openui-forge-rust
OthmanAdi
OpenUI generative UI with Rust Axum backend. Async SSE streaming with reqwest and async-stream.
add-tauri-command
Konadu-Akwasi-Akuoko
Use when adding, renaming, or changing the signature of a Tauri command in src-tauri — any new IPC surface between the Rust core and the React UI.