Add a Tauri command

VerifiedSafe

End-to-end checklist for adding, renaming, or changing a Tauri command, covering Rust, TypeScript, tests, and capabilities.

Sby Skills Guide Bot
DevelopmentIntermediate
7/23/2026
Claude CodeCursorCodex
#tauri#ipc#rust#typescript#bindings

Recommended for

Automated summary

Step-by-step checklist for adding, renaming, or changing a Tauri command in src-tauri so the Rust core and React UI stay typed end to end.

Strengths

  • Ordered checklist covering domain module, signature, registration, bindings, typed TS wrapper, tests, and capabilities
  • Calls out real Tauri pitfalls: a second invoke_handler silently winning, String errors losing the kind discriminant, events instead of Channel<T> for streaming
  • Enforces a thin command shell with business logic pushed down into engine / db / jobs layers
  • Covers specta binding regeneration and two-sided testing, including mockIPC and clearMocks

Limitations

  • Assumes a specific stack (specta, TanStack Query, justfile, commands/<domain>.rs layout) and fits poorly with a differently structured Tauri project
  • Describes the process but not the actual code to write or alternative signature shapes
  • Relies on external commands (just bindings, just check) whose behaviour is not explained
When to use it

Use whenever the IPC surface of a Tauri app changes: a new command, a rename, or a signature change.

When not to use it

Skip it for frontend-only work with no IPC, or on Tauri projects that don't use specta and this folder convention.

Security analysis

Safe
Quality score90/100

The skill is a documentation-only checklist for adding Tauri commands. It does not execute commands, handle secrets, modify system state, or instruct destructive/network exfiltration actions. References to `just check` and bindings generation are normal developer workflow steps without embedded payloads.

No concerns found

How this analysis is made

Examples

New command end to end
Add a Tauri command that exports the current project to PDF, register it, regenerate the bindings, and wire it to a React button with a typed wrapper and a test.
Rename and change signature
Rename the `save_note` Tauri command to `update_note` and change it to take a note id plus the updated body, then update the bindings, TS wrapper, and tests.
Streaming progress
Add a Tauri command that runs a long import job and streams progress to the UI — use Channel<T> rather than events, and add Rust and TS tests.

name: add-tauri-command description: 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.

Add a Tauri command

End-to-end checklist. A command is not "done" until both sides are typed and tested.

Checklist (todo per item)

  1. Domain module. Add the command to src-tauri/src/commands/<domain>.rs (create the domain file if new — never a catch-all module). Name: snake_case verb phrase, one command per user-facing action.
  2. Signature. async fn if it does I/O; owned params; State<'_, AppState> for state; Channel<T> param if it streams. Returns Result<T, Error> (the app error enum — add a variant if no existing one fits; wrap engine errors via #[from]).
  3. Thin shell. Body = unwrap args → call engine / db/ repository / jobs layer → map errors. If you're writing SQL or business logic inside the command, stop and move it down a layer.
  4. Register. Add to the single generate_handler![...] list in lib.rs (and to tauri_specta::Builder command list). There is exactly one registration site.
  5. Regenerate bindings. Run the specta export (see justfile: just bindings) so src/lib/ipc/bindings.gen.ts updates. Never hand-edit that file.
  6. Typed wrapper. Expose it from src/lib/ipc/<domain>.ts re-exporting the generated function with any ergonomics (query-key helpers for TanStack Query). Feature code imports the wrapper, never the bindings file or raw invoke.
  7. Tests, both sides. Rust: unit test for the layer the command delegates to (the command itself stays thin enough not to need one); if the command has branching, test it with a test AppState. TS: if a hook/component consumes it, mock via mockIPC in the colocated test.
  8. Capabilities. If the command needs a plugin permission, add it to the relevant file in src-tauri/capabilities/ (per-concern files, minimum scope).
  9. Gate. just check.

Common mistakes

  • Registering in a second invoke_handler call — Tauri silently keeps only the last one.
  • Returning String errors — the frontend loses the kind discriminant.
  • Streaming via events instead of Channel<T> — events are broadcast and unordered per docs; channels are the streaming path.
  • Forgetting clearMocks() in the TS test — IPC mocks leak across tests.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/add-a-tauri-command-mrx3y02b/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/add-a-tauri-command-mrx3y02b' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/add-a-tauri-command-mrx3y02b/download' --output '.skill-downloads/add-a-tauri-command-mrx3y02b/SKILL.md.part' && mv '.skill-downloads/add-a-tauri-command-mrx3y02b/SKILL.md.part' '.skill-downloads/add-a-tauri-command-mrx3y02b/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/add-a-tauri-command-mrx3y02b/SKILL.md' && test -s '.skill-downloads/add-a-tauri-command-mrx3y02b/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/add-tauri-command' && cp -R '.skill-downloads/add-a-tauri-command-mrx3y02b' '.claude/skills/add-tauri-command'

Cursor
test -f '.skill-downloads/add-a-tauri-command-mrx3y02b/SKILL.md' && test -s '.skill-downloads/add-a-tauri-command-mrx3y02b/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/add-tauri-command' && cp -R '.skill-downloads/add-a-tauri-command-mrx3y02b' '.cursor/skills/add-tauri-command'

Codex
test -f '.skill-downloads/add-a-tauri-command-mrx3y02b/SKILL.md' && test -s '.skill-downloads/add-a-tauri-command-mrx3y02b/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/add-tauri-command' && cp -R '.skill-downloads/add-a-tauri-command-mrx3y02b' '.agents/skills/add-tauri-command'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/add-a-tauri-command-mrx3y02b'

openskills read 'add-a-tauri-command-mrx3y02b'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/add-a-tauri-command-mrx3y02b/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills