tauri-pty
Skill6 starsChanged 8 months agoMITView on GitHub
Expert guide for building terminal emulators and PTY (pseudo-terminal) integrations in Tauri 2 applications with a React frontend. Use this skill whenever the user mentions: building a terminal in Tauri, using portable_pty, tauri-plugin-pty, xterm.js in a Tauri app, spawning shell processes in Tauri, streaming PTY output, wiring keyboard input to a shell, or building anything that behaves like a terminal tab or terminal emulator inside a desktop app. Also trigger for: "how do I run commands in Tauri", "Tauri shell integration", "interactive CLI in Tauri", or "embed a terminal in my Tauri app". This skill covers the full vertical stack — Cargo.toml setup, Rust plugin registration, React component wiring, xterm theming, resize handling, multi-tab management, cross-platform shell detection, and production best practices. Always use this skill in full when the user is building or debugging a Tauri terminal — don't rely on memory alone.
- Installs packages
1 other project uses a version of this.
Adopted by
Most recently taken up by
- tim-osterhus/millrace-skillstheir own version, first seen Apr 28, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- tim-osterhus/millrace-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 52
When a user asks to build a Tauri terminal, follow this sequence:
- Very specific: line 57
If multi-tab is needed → read references/multi-tab.md
- Very specific: line 58
Before finalizing → read references/best-practices.md for gotchas
- Distinctive: line 60
Always produce working, copy-pasteable code.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Tauri PTY Skill
A complete vertical guide for embedding a fully functional terminal emulator inside a Tauri 2 +
React desktop application using tauri-plugin-pty and xterm.js.
Quick Decision: Which Approach?
| Situation | Recommended Approach |
| Standard terminal tab/panel | tauri-plugin-pty (Option A — this skill) |
| Need deep PTY lifecycle control | Manual portable_pty (Option B — see references/rust-backend.md) |
| Multiple terminal tabs | tauri-plugin-pty + React state (covered here) |
| PTY inside a Tauri Webview only | Option A |
| Streaming huge volumes of data | Consider Tauri Channels — see references/best-practices.md |
This skill defaults to Option A (tauri-plugin-pty). It is the least boilerplate, most
maintainable path for the vast majority of Tauri terminal use cases.
Reference Files — Read These As Needed
| File | When to Read It |
references/rust-backend.md | Cargo setup, plugin registration, manual portable_pty deep dive |
references/react-frontend.md | Full React component code, hooks, TypeScript types |
references/xterm-integration.md | xterm.js addons, themes, fonts, key bindings, Unicode |
references/multi-tab.md | Tab management, session persistence, splitting panes |
references/best-practices.md | Performance, security, cross-platform quirks, common bugs |
Skill Workflow
When a user asks to build a Tauri terminal, follow this sequence:
- Read
references/rust-backend.md— set up Cargo.toml and register the plugin - Read
references/react-frontend.md— scaffold the Terminal React component - Read
references/xterm-integration.md— wire addons, apply theme, handle resize - If multi-tab is needed → read
references/multi-tab.md - Before finalizing → read
references/best-practices.mdfor gotchas
Always produce working, copy-pasteable code. Never produce pseudocode unless the user asks for it.
Minimal Working Example (Quick Reference)
Cargo.toml
[dependencies]
tauri = { version = "2", features = [] }
tauri-plugin-pty = "0.1"src-tauri/src/lib.rs
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_pty::init())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}Frontend install
npm install tauri-pty @xterm/xterm @xterm/addon-fit @xterm/addon-web-linksTerminal.tsx (minimal)
import { useEffect, useRef } from "react";
import { Terminal } from "@xterm/xterm";
import { FitAddon } from "@xterm/addon-fit";
import { spawn } from "tauri-pty";
import "@xterm/xterm/css/xterm.css";
export default function TerminalView() {
const ref = useRef<HTMLDivElement>(null);
useEffect(() => {
if (!ref.current) return;
const term = new Terminal({ cursorBlink: true });
const fit = new FitAddon();
term.loadAddon(fit);
term.open(ref.current);
fit.fit();
const shell = navigator.userAgent.includes("Windows") ? "powershell.exe" : "bash";
const pty = spawn(shell, [], {
cols: term.cols,
rows: term.rows,
env: { TERM: "xterm-256color" },
});
pty.onData((data) => term.write(data));
term.onData((data) => pty.write(data));
term.onResize(({ cols, rows }) => pty.resize(cols, rows));
const onResize = () => fit.fit();
window.addEventListener("resize", onResize);
return () => {
window.removeEventListener("resize", onResize);
term.dispose();
};
}, []);
return <div ref={ref} style={{ width: "100%", height: "100%", background: "#1e1e1e" }} />;
}For anything beyond this minimal example, read the relevant reference files listed above.
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
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.

