con un clic
rust-backend
Rust/Tauri v2 backend patterns for agentcockpit native functionality
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
Rust/Tauri v2 backend patterns for agentcockpit native functionality
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Testing strategy, patterns, and coverage optimization for quality assurance. Use this skill whenever the task involves deciding what to test, how to structure tests, what coverage to aim for, when to use mocks vs real dependencies, or how to write tests that actually catch bugs (not just pass). Also use when the user asks about test pyramids, flaky tests, integration vs unit, TDD, or improving an existing test suite.
Production readiness validation — runs all checks before merging or deploying. Use this skill whenever the task involves verifying that code is ready to ship: type checking, linting, tests passing, coverage thresholds, dead code, security issues, or any pre-merge checklist. Also use when the user asks "is this ready?", wants a pre-PR review, or needs to confirm nothing is broken after a refactor.
Swift architecture reference — SwiftUI, UIKit, Combine, async/await, actors, and production best practices for Swift 5.9/6.0 (2024-2025). Use when making architectural decisions, reviewing Swift code, or selecting libraries. Also use when the user mentions iOS development, macOS apps, or Apple platform development.
UI/Frontend architecture reference - React 19, Next.js 15, Vue 3, Svelte 5, Angular 19, CSS modern features, component libraries, state management, and production best practices for 2024-2025. Use when building frontend UIs, selecting frameworks, reviewing component code, or making frontend architecture decisions.
UX design reference - research methods, design systems, accessibility (WCAG 2.2, EAA), UX laws, AI-driven workflows, tools (Figma, Penpot), and production best practices for 2024-2025. Use when making UX decisions, reviewing designs, implementing accessibility, selecting design tools, or applying UX principles.
C# architecture reference - frameworks, design patterns, ASP.NET Core, Entity Framework, Blazor, Unity, and production best practices for C# 12/13 and .NET 8/9 (2024-2025). Use when making architectural decisions, reviewing C# code, or selecting libraries.
Basado en la clasificación ocupacional SOC
| name | rust-backend |
| description | Rust/Tauri v2 backend patterns for agentcockpit native functionality |
agentcockpit's Rust backend provides native capabilities: PTY management, embedded browser, codebase analysis process management, and shell command execution.
src-tauri/
├── Cargo.toml # Dependencies and Tauri plugins
├── src/
│ ├── lib.rs # Main Tauri setup, command registration, DCC process mgmt
│ ├── pty.rs # PtyManager: spawn, write, resize, close
│ └── browser.rs # BrowserState: webview create, navigate, show/hide
├── tauri.conf.json # Tauri config (window, plugins, permissions)
└── capabilities/ # Permission definitions
#[tauri::command]
async fn my_command(app: AppHandle, arg: String) -> Result<String, String> {
// Use parking_lot Mutex for state
let state = app.state::<Mutex<MyState>>();
let mut guard = state.lock();
// ... do work
Ok(result)
}
use parking_lot::Mutex;
// Register state in lib.rs
app.manage(Mutex::new(PtyManager::new()));
app.manage(Mutex::new(BrowserState::new()));
// Access in commands
let pty = app.state::<Mutex<PtyManager>>();
let mut pty = pty.lock(); // parking_lot: no .unwrap() needed
// PTY reader thread pattern
std::thread::spawn(move || {
let mut buf = [0u8; 4096];
loop {
match reader.read(&mut buf) {
Ok(0) => break,
Ok(n) => {
let data = String::from_utf8_lossy(&buf[..n]).to_string();
let _ = app.emit(&format!("pty-output-{}", id), data);
}
Err(_) => break,
}
}
});
use libc::{kill, SIGTERM, SIGKILL};
// Graceful shutdown: SIGTERM, wait, SIGKILL
unsafe { kill(-(pid as i32), SIGTERM); }
std::thread::sleep(Duration::from_millis(100));
unsafe { kill(-(pid as i32), SIGKILL); }
| Crate | Version | Purpose |
|---|---|---|
tauri | 2.9.5 | Desktop framework |
portable-pty | 0.8 | Cross-platform PTY |
parking_lot | 0.12 | Fast Mutex (no poisoning) |
serde + serde_json | 1.0 | Serialization |
uuid | 1.x | UUID v4 generation |
tiny_http | 0.12 | Debug HTTP server |
parking_lot::Mutex over std::sync::Mutex — no poisoning, faster-pid) not individual processesResult<T, String> for Tauri command return types (serializable errors)