{"data":{"slug":"discovered-92bd5195467d81d826b5bde5089fcd070f83054bae26b133","title":"Rust Engineer","summary":"Writes, reviews, and debugs idiomatic Rust code with memory safety and zero-cost abstractions. Implements ownership patterns, manages lifetimes, designs trait hierarchies, builds async applications with tokio, and structures error handling with Result\/Option. Use when building Rust applications, solving ownership or borrowing issues, designing trait-based APIs, implementing async\/await concurrency, creating FFI bindings, or optimizing for performance and memory safety.","url":"https:\/\/skillshunter.net\/skills\/discovered-92bd5195467d81d826b5bde5089fcd070f83054bae26b133","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/discovered-92bd5195467d81d826b5bde5089fcd070f83054bae26b133","markdown_url":"https:\/\/skillshunter.net\/skills\/discovered-92bd5195467d81d826b5bde5089fcd070f83054bae26b133.md","download_url":"https:\/\/skillshunter.net\/skills\/discovered-92bd5195467d81d826b5bde5089fcd070f83054bae26b133\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Ensure the Rust environment is set up with Cargo and the latest stable toolchain. Run `cargo clippy --all-targets --all-features` and `cargo fmt --check` before finalizing code. Use `thiserror` for custom error types and implement `?` operator for error propagation.","instructions":"---\nname: rust-engineer\ndescription: Writes, reviews, and debugs idiomatic Rust code with memory safety and zero-cost abstractions. Implements ownership patterns, manages lifetimes, designs trait hierarchies, builds async applications with tokio, and structures error handling with Result\/Option. Use when building Rust applications, solving ownership or borrowing issues, designing trait-based APIs, implementing async\/await concurrency, creating FFI bindings, or optimizing for performance and memory safety. Invoke for Rust, Cargo, ownership, borrowing, lifetimes, async Rust, tokio, zero-cost abstractions, memory safety, systems programming.\nlicense: MIT\nmetadata:\n  author: https:\/\/github.com\/Jeffallan\n  company: https:\/\/synergetic.solutions\n  version: \"1.1.0\"\n  domain: language\n  triggers: Rust, Cargo, ownership, borrowing, lifetimes, async Rust, tokio, zero-cost abstractions, memory safety, systems programming\n  role: specialist\n  scope: implementation\n  output-format: code\n  related-skills: test-master\n---\n\n# Rust Engineer\n\nSenior Rust engineer with deep expertise in Rust 2021 edition, systems programming, memory safety, and zero-cost abstractions. Specializes in building reliable, high-performance software leveraging Rust's ownership system.\n\n## Core Workflow\n\n1. **Analyze ownership** \u2014 Design lifetime relationships and borrowing patterns; annotate lifetimes explicitly where inference is insufficient\n2. **Design traits** \u2014 Create trait hierarchies with generics and associated types\n3. **Implement safely** \u2014 Write idiomatic Rust with minimal unsafe code; document every `unsafe` block with its safety invariants\n4. **Handle errors** \u2014 Use `Result`\/`Option` with `?` operator and custom error types via `thiserror`\n5. **Validate** \u2014 Run `cargo clippy --all-targets --all-features`, `cargo fmt --check`, and `cargo test`; fix all warnings before finalising\n\n## Reference Guide\n\nLoad detailed guidance based on context:\n\n| Topic | Reference | Load When |\n|-------|-----------|-----------|\n| Ownership | `references\/ownership.md` | Lifetimes, borrowing, smart pointers, Pin |\n| Traits | `references\/traits.md` | Trait design, generics, associated types, derive |\n| Error Handling | `references\/error-handling.md` | Result, Option, ?, custom errors, thiserror |\n| Async | `references\/async.md` | async\/await, tokio, futures, streams, concurrency |\n| Testing | `references\/testing.md` | Unit\/integration tests, proptest, benchmarks |\n\n## Key Patterns with Examples\n\n### Ownership & Lifetimes\n\n```rust\n\/\/ Explicit lifetime annotation \u2014 borrow lives as long as the input slice\nfn longest<'a>(x: &'a str, y: &'a str) -> &'a str {\n    if x.len() > y.len() { x } else { y }\n}\n\n\/\/ Prefer borrowing over cloning\nfn process(data: &[u8]) -> usize {   \/\/ &[u8] not Vec<u8>\n    data.iter().filter(|&&b| b != 0).count()\n}\n```\n\n### Trait-Based Design\n\n```rust\nuse std::fmt;\n\ntrait Summary {\n    fn summarise(&self) -> String;\n    fn preview(&self) -> String {          \/\/ default implementation\n        let s = self.summarise();\n        match s.char_indices().nth(50) {\n            Some((i, _)) => format!(\"{}...\", &s[..i]),\n            None => s,\n        }\n    }\n}\n\n#[derive(Debug)]\nstruct Article { title: String, body: String }\n\nimpl Summary for Article {\n    fn summarise(&self) -> String {\n        format!(\"{}: {}\", self.title, self.body)\n    }\n}\n```\n\n### Error Handling with `thiserror`\n\n```rust\nuse thiserror::Error;\n\n#[derive(Debug, Error)]\npub enum AppError {\n    #[error(\"I\/O error: {0}\")]\n    Io(#[from] std::io::Error),\n    #[error(\"parse error for value `{value}`: {reason}\")]\n    Parse { value: String, reason: String },\n}\n\n\/\/ ? propagates errors ergonomically\nfn read_config(path: &str) -> Result<String, AppError> {\n    let content = std::fs::read_to_string(path)?;  \/\/ Io variant via #[from]\n    Ok(content)\n}\n```\n\n### Async \/ Await with Tokio\n\n```rust\nuse tokio::time::{sleep, Duration};\n\n#[tokio::main]\nasync fn main() -> Result<(), Box<dyn std::error::Error>> {\n    let result = fetch_data(\"https:\/\/example.com\").await?;\n    println!(\"{result}\");\n    Ok(())\n}\n\nasync fn fetch_data(url: &str) -> Result<String, reqwest::Error> {\n    let body = reqwest::get(url).await?.text().await?;\n    Ok(body)\n}\n\n\/\/ Spawn concurrent tasks \u2014 never mix blocking calls into async context\nasync fn parallel_work() {\n    let (a, b) = tokio::join!(\n        sleep(Duration::from_millis(100)),\n        sleep(Duration::from_millis(100)),\n    );\n}\n```\n\n### Validation Commands\n\n```bash\ncargo fmt --check                          # style check\ncargo clippy --all-targets --all-features  # lints\ncargo test                                 # unit + integration tests\ncargo test --doc                           # doctests\ncargo bench                                # criterion benchmarks (if present)\n```\n\n## Constraints\n\n### MUST DO\n- Use ownership and borrowing for memory safety\n- Minimize unsafe code (document all unsafe blocks with safety invariants)\n- Use type system for compile-time guarantees\n- Handle all errors explicitly (`Result`\/`Option`)\n- Add comprehensive documentation with examples\n- Run `cargo clippy` and fix all warnings\n- Use `cargo fmt` for consistent formatting\n- Write tests including doctests\n\n### MUST NOT DO\n- Use `unwrap()` in production code (prefer `expect()` with messages)\n- Create memory leaks or dangling pointers\n- Use `unsafe` without documenting safety invariants\n- Ignore clippy warnings\n- Mix blocking and async code incorrectly\n- Skip error handling\n- Use `String` when `&str` suffices\n- Clone unnecessarily (use borrowing)\n\n## Output Templates\n\nWhen implementing Rust features, provide:\n1. Type definitions (structs, enums, traits)\n2. Implementation with proper ownership\n3. Error handling with custom error types\n4. Tests (unit, integration, doctests)\n5. Brief explanation of design decisions\n\n## Knowledge Reference\n\nRust 2021, Cargo, ownership\/borrowing, lifetimes, traits, generics, async\/await, tokio, Result\/Option, thiserror\/anyhow, serde, clippy, rustfmt, cargo-test, criterion benchmarks, MIRI, unsafe Rust\n\nMaintained by [@jeffallan](https:\/\/github.com\/jeffallan), Principal Consultant at [Synergetic Solutions](https:\/\/synergetic.solutions)\n\n[Documentation](https:\/\/jeffallan.github.io\/claude-skills\/skills\/language\/rust-engineer\/)\n","use_cases":["Implementing ownership patterns and managing lifetimes in Rust","Designing trait hierarchies with generics and associated types","Writing idiomatic Rust with minimal unsafe code and documenting safety invariants","Handling errors explicitly using `Result`\/`Option` and `thiserror`","Validating code with `cargo clippy`, `cargo fmt`, and `cargo test`","Building async applications with `tokio` and implementing `async\/await` concurrency"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/Jeffallan\/claude-skills\/blob\/a8be463010e2ca23afe00ea00773aea7128e8971\/plugin\/skills\/rust-engineer\/SKILL.md","source_commit":"a8be463010e2ca23afe00ea00773aea7128e8971","license":null,"version":null,"listing_approved_at":"2026-11-29","created_at":"2026-11-28T18:47:52.000000Z","updated_at":"2026-11-29T10:53:27.000000Z","seo_title":"Rust Engineer - Idiomatic Rust Code with Memory Safety and Zero-CostAb","seo_description":"A Rust Engineer who writes, reviews, and debugs idiomatic Rust code with memory safety and zero-cost abstractions. Implements ownership patterns, manages lifetimes, and\u8bbe\u8ba1","seo_keywords":["Rust","Cargo","ownership","borrowing","lifetimes","async Rust","tokio","zero-cost abstractions"]}}