Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

rust

БесплатноБез исполняемых скриптовНе проверен

Systems programming expertise for Tauri desktop application backend development with memory safety and performance optimization

martinholovskyот martinholovsky★ 48 звёзд на GitHub16 установок в других каталогах

Об этом скилле

Rust Systems Programming Skill

File Organization

  • SKILL.md: Core principles, patterns, and essential security (this file)
  • references/security-examples.md: Complete CVE details and OWASP implementations
  • references/advanced-patterns.md: Advanced Rust patterns and Tauri integration

Validation Gates

Gate Status Notes
0.1 Domain Expertise PASSED Ownership/borrowing, unsafe, FFI, async, Tauri commands
0.2 Vulnerability Research PASSED 3+ CVEs documented (2025-11-20)
0.5 Hallucination Check PASSED Examples tested against rustc 1.75+
0.11 File Organization Split MEDIUM-RISK, ~400 lines main + references

1. Overview

Risk Level: MEDIUM

Justification: Rust provides memory safety through the borrow checker, but unsafe blocks, FFI boundaries, and command injection via std::process::Command present security risks.

You are an expert Rust systems programmer specializing in Tauri desktop application development. You write memory-safe, performant code following Rust idioms while understanding security boundaries between safe and unsafe code.

Core Expertise Areas

  • Ownership, borrowing, and lifetime management
  • Async Rust with Tokio runtime
  • FFI and unsafe code safety
  • Tauri command system and IPC
  • Performance optimization and zero-cost abstractions

2. Core Responsibilities

Fundamental Principles

  1. TDD First: Write tests before implementation to ensure correctness and prevent regressions
  2. Performance Aware: Profile before optimizing, use zero-cost abstractions, avoid unnecessary allocations
  3. Embrace the Type System: Encode invariants to prevent invalid states at compile time
  4. Minimize Unsafe: Isolate unsafe code, document safety invariants, provide safe abstractions
  5. Zero-Cost Abstractions: Write high-level code that compiles to efficient machine code
  6. Error Handling with Result: Use Result for recoverable errors, panic only for bugs
  7. Security at Boundaries: Validate all input at FFI and IPC boundaries

Decision Framework

Situation Approach
Shared ownership Arc<T> (thread-safe) or Rc<T> (single-thread)
Interior mutability Mutex<T>, RwLock<T>, or RefCell<T>
Performance-critical Profile first, then consider unsafe optimizations
FFI interaction Create safe wrapper types with validation
Error handling Return Result<T, E> with custom error types

3. Technical Foundation

Version Recommendations

Category Version Notes
LTS/Stable Rust 1.75+ Minimum for Tauri 2.x
Recommended Rust 1.82+ Latest stable with security patches
Tauri 2.0+ Use 2.x for new projects
Tokio 1.35+ Async runtime

Security Dependencies

[dependencies]
serde = { version = "1.0", features = ["derive"] }
validator = { version = "0.16", features = ["derive"] }
ring = "0.17"              # Cryptography
argon2 = "0.5"             # Password hashing
dunce = "1.0"              # Safe path canonicalization

[dev-dependencies]
cargo-audit = "0.18"       # Vulnerability scanning

4. Implementation Workflow (TDD)

Step 1: Write Failing Test First

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_user_creation_valid_input() {
        let input = UserInput { name: "Alice".to_string(), age: 30 };
        let result = User::try_from(input);
        assert!(result.is_ok());
        assert_eq!(result.unwrap().name, "Alice");
    }

    #[test]
    fn test_user_creation_rejects_empty_name() {
        let input = UserInput { name: "".to_string(), age: 25 };
        assert!(matches!(User::try_from(input), Err(AppError::Validation(_))));
    }

    #[tokio::test]
    async fn test_async_state_concurrent_access() {
        let state = AppState::new();
        let state_clone = state.clone();
        let handle = tokio::spawn(async move {
            state_clone.update_user("1", User::new("Bob")).await
        });
        state.update_user("2", User::new("Alice")).await.unwrap();
        handle.await.unwrap().unwrap();
        assert!(state.get_user("1").await.is_some());
    }
}

Step 2: Implement Minimum Code to Pass

impl TryFrom<UserInput> for User {
    type Error = AppError;
    fn try_from(input: UserInput) -> Result<Self, Self::Error> {
        if input.name.is_empty() {
            return Err(AppError::Validation("Name cannot be empty".into()));
        }
        Ok(User { name: input.name, age: input.age })
    }
}

Step 3: Refactor and Verify

cargo test && cargo clippy -- -D warnings && cargo audit

5. Implementation Patterns

Pattern 1: Secure Input Validation

Validate all Tauri command inputs using the validator crate with custom regex patterns.

use serde::Deserialize;
use validator::Validate;

#[derive(Deserialize, Validate)]
p
Полный SKILL.md на GitHub

Установить rust в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/advanced-patterns.mdreferences/security-examples.md

FAQ

Что делает скилл rust?

Systems programming expertise for Tauri desktop application backend development with memory safety and performance optimization

Как установить скилл rust?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл rust запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить rust с