- Home
- Skills
- Jeffallan
- Claude Skills
- Rust Engineer
rust-engineer_skill
- HTML
110
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill jeffallan/claude-skills --skill rust-engineer- SKILL.md3.6 KB
Overview
This skill is a senior Rust engineer persona focused on building memory-safe, high-performance systems using Rust 2021. It guides ownership and lifetime design, trait-based APIs, async programming with tokio, and disciplined error handling. Use it to get concrete, production-ready code patterns and tests that follow Rust best practices.
How this skill works
The skill inspects code intent and recommends ownership/borrowing shapes, lifetime annotations, and appropriate smart pointers. It generates type definitions, trait hierarchies, implementations with explicit error types, async handlers (tokio) when needed, and accompanying tests and formatting guidance. It enforces constraints like minimal unsafe, documented invariants, clippy-clean code, and explicit error handling.
When to use it
- Designing ownership and lifetime relationships for safe APIs
- Creating trait hierarchies and generic, zero-cost abstractions
- Implementing async services or background tasks with tokio
- Building FFI bindings or carefully scoped unsafe abstractions
- Optimizing hot paths and eliminating unnecessary cloning
- Writing thorough tests, benchmarks, and CI-friendly checks
Best practices
- Prefer borrowing (&, &mut) and lifetimes over owned String/Vec when possible
- Model fallible operations with Result and propagate errors with ?
- Keep unsafe blocks minimal and include precise safety comments
- Run cargo fmt and clippy; address all warnings before merging
- Document APIs and invariants with examples and doctests
- Avoid mixing blocking code in async contexts; use spawn_blocking where needed
Example use cases
- Designing a generic storage trait with associated types and a concrete in-memory implementation
- Refactoring a synchronous module to async/await with tokio and graceful shutdown
- Implementing a safe wrapper over an unsafe FFI library with documented invariants
- Creating a custom error enum using thiserror and wiring it through Result returns
- Adding unit, integration, and criterion benchmarks to validate performance changes
FAQ
Only when necessary. I minimize unsafe, document all safety invariants, and isolate unsafe code behind safe APIs.
How do you handle async and blocking code together?
Avoid blocking in async tasks; use tokio::task::spawn_blocking for blocking work and prefer nonblocking crates where available.