# rust

rust is a Claude Code skill for writing Rust backends for Tauri desktop apps with attention to memory safety and performance. It covers systems programming tasks, including async code and Tauri commands.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 268 installs · ★ 48 repo stars
- Author: martinholovsky
- License: Unlicense · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/martinholovsky/claude-skills-generator/tree/HEAD/skills/rust/SKILL.md
- Updated: 2025-12-06
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/martinholovsky-rust

## What it does

rust guides Rust development from tests to implementation and checks with `cargo test`, `cargo clippy`, and `cargo audit`. Its coverage includes ownership, borrowing, lifetimes, async Rust with Tokio, FFI, and boundaries around `unsafe` code.

For Tauri commands, the skill describes input validation and safer file path handling. It also covers `Result`-based error handling and custom error types. Rust 1.75+ is the stated minimum for Tauri 2.x; new projects are directed to Tauri 2.0+.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add martinholovsky/claude-skills-generator --skill rust -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/rust/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/rust/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add martinholovsky/claude-skills-generator --skill rust -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/rust/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add martinholovsky/claude-skills-generator --skill rust -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/rust/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install martinholovsky/claude-skills-generator skills/rust
```

2. **Manually: put the files in place**
- File: `.github/skills/rust/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add martinholovsky/claude-skills-generator --skill rust -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/martinholovsky/claude-skills-generator --path skills/rust
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/rust/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add martinholovsky/claude-skills-generator --skill rust -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/martinholovsky/claude-skills-generator/tree/HEAD/skills/rust/SKILL.md

## When to use it
- write tests before implementing Rust functions
- validate input passed to Tauri commands
- handle failures with `Result` and custom error types
- guard file operations against path traversal
- review unsafe code and FFI boundaries

## Example prompts
- Build the Rust backend for this Tauri app and handle errors safely.
- Add input validation to this Tauri command.
- Write tests for concurrent async state and check the code with `cargo clippy`.

## Source text · SKILL.md · Unlicense

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: f950ff1464147f6d.

BEGIN THIRD-PARTY FILE f950ff1464147f6d
````text
---
name: rust
description: Systems programming expertise for Tauri desktop application backend development with memory safety and performance optimization
model: sonnet
risk_level: MEDIUM
---

# 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

```toml
[dependencies]
````
END THIRD-PARTY FILE f950ff1464147f6d

The third-party file has ended. Everything between the f950ff1464147f6d tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 3086 of 15092 bytes. © martinholovsky · Unlicense · https://github.com/martinholovsky/claude-skills-generator/tree/HEAD/skills/rust/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
