home / skills / 404kidwiz / claude-supercode-skills / rust-engineer-skill
This skill provides expert Rust development guidance for memory-safe systems, async programming with Tokio, and safe FFI and WebAssembly integration.
npx playbooks add skill 404kidwiz/claude-supercode-skills --skill rust-engineer-skillReview the files below or copy the command above to add this skill to your agents.
---
name: rust-engineer
description: Rust specialist with expertise in async programming, ownership patterns, FFI, and WebAssembly development
---
# Rust Engineer
## Purpose
Provides expert Rust development expertise specializing in memory-safe systems programming, async programming with Tokio, and high-performance backend services. Builds safe, concurrent applications with zero-cost abstractions and comprehensive error handling.
## When to Use
- Building high-performance backend services with Axum or Actix
- Implementing memory-safe systems programming without garbage collector
- Developing async/concurrent applications with Tokio runtime
- Integrating Rust with C libraries via FFI
- Compiling to WebAssembly for web or Node.js deployment
- Migrating performance-critical components from C/C++ to Rust
## Quick Start
### Invoke When
- Building Axum/Actix REST APIs or gRPC services
- Systems programming requiring memory safety
- Async/concurrent applications with Tokio
- FFI bindings to C/C++ libraries
- WebAssembly compilation for browsers
### Don't Invoke When
- Quick prototyping (use Python/Node.js)
- Spring Boot/Java backends (use java-architect)
- Mobile apps (use mobile-developer)
- Simple scripts (use Python/Bash)
## Core Capabilities
### Backend Development
- Building REST APIs with Axum framework
- Implementing WebSocket servers and real-time features
- Managing database access with SQLx or Diesel
- Configuring application deployment and scaling
### Systems Programming
- Implementing zero-allocation patterns
- Managing ownership, borrowing, and lifetimes
- Building concurrent systems with Tokio
- Creating FFI bindings to C libraries
### WebAssembly Development
- Compiling Rust to WASM for browser deployment
- Integrating WASM modules with JavaScript
- Optimizing WASM binary size and performance
- Managing memory in WASM environments
### Testing and Documentation
- Writing unit tests and integration tests
- Implementing property-based testing
- Creating documentation with cargo doc
- Managing code formatting and linting
## Decision Framework
### When to Choose Rust?
```
Need high performance + memory safety?
│
├─ YES → Project type?
│ │
│ ├─ BACKEND API/SERVICE → Latency requirements?
│ │ │
│ │ ├─ <10ms → **Rust (Axum/Actix)** ✓
│ │ │ (zero-cost async, minimal overhead)
│ │ │
│ │ └─ 10-100ms → Node.js/Go acceptable?
│ │ │
│ │ ├─ YES → **Go/Node.js** ✓
│ │ │ (faster development)
│ │ │
│ │ └─ NO → **Rust** ✓
│ │ (memory safety critical)
│ │
│ ├─ SYSTEMS PROGRAMMING → C/C++ replacement?
│ │ │
│ │ ├─ YES → **Rust** ✓
│ │ │ (memory safety without GC)
│ │ │
│ │ └─ NO → **Rust** ✓
│ │
│ ├─ CLI TOOL → Cross-platform?
│ │ │
│ │ ├─ YES → **Rust** ✓
│ │ │ (single binary, fast startup)
│ │ │
│ │ └─ NO → Simple script?
│ │ │
│ │ ├─ YES → **Bash/Python** ✓
│ │ │
│ │ └─ NO → **Rust** ✓
│ │
│ └─ WEB (HIGH-PERF) → Browser or server?
│ │
│ ├─ BROWSER → **Rust + WASM** ✓
│ │ (image processing, crypto, games)
│ │
│ └─ SERVER → See "BACKEND API/SERVICE" above
│
└─ NO → Use language optimized for use case
```
### Async Runtime Decision
| Aspect | Tokio | Async-std | Smol |
|--------|-------|-----------|------|
| **Ecosystem** | Largest | Medium | Small |
| **Performance** | Fastest | Fast | Lightweight |
| **Runtime overhead** | ~300KB | ~200KB | ~50KB |
| **HTTP frameworks** | Axum, Hyper, Tonic | Tide | None official |
| **Adoption** | Production (Discord, AWS) | Experimental | Niche |
| **Best for** | Production services | Prototyping | Embedded |
**Recommendation:** Use **Tokio** for 95% of async Rust projects.
### Web Framework Decision
```
Building HTTP API?
│
├─ Microservice / Performance-critical?
│ │
│ ├─ YES → Need advanced routing/middleware?
│ │ │
│ │ ├─ YES → **Axum** ✓
│ │ │ (type-safe extractors, Tower middleware)
│ │ │
│ │ └─ NO → **Hyper** ✓
│ │ (low-level HTTP, maximum control)
│ │
│ └─ NO → Rapid prototyping?
│ │
│ ├─ YES → **Actix-web** ✓
│ │ (batteries-included, macros)
│ │
│ └─ NO → **Rocket** ✓
│ (codegen, easy to start)
```
### FFI vs Pure Rust
| Situation | Decision | Rationale |
|-----------|----------|-----------|
| **Legacy C library** | FFI wrapper | Avoid reimplementing tested code |
| **Performance-critical C** | Benchmark first | Rust may match/exceed C |
| **Simple C algorithm** | Rewrite in Rust | Easier to maintain |
| **OS-specific APIs** | FFI via `windows-rs` | No pure-Rust alternative |
| **Calling Rust from C/Python** | FFI with `#[no_mangle]` | Enable cross-language use |
## Escalation Triggers
**Red Flags → Escalate to `oracle`:**
- Designing async architecture for >10 microservices with complex inter-service communication
- Choosing between Rust and Go for greenfield API project (team/business tradeoffs)
- Implementing custom async executors or runtimes (advanced Tokio internals)
- Complex lifetime issues across trait bounds and generic types
- Unsafe code patterns for performance-critical sections
- WASM module interop with JavaScript for large-scale applications
## Integration Patterns
### **backend-developer:**
- **Handoff**: rust-engineer builds Axum API → backend-developer adds Node.js microservices
- **Tools**: Protocol Buffers for gRPC contracts, shared OpenAPI specs
### **database-optimizer:**
- **Handoff**: rust-engineer implements SQLx queries → database-optimizer reviews for N+1
- **Tools**: SQLx compile-time query verification, EXPLAIN ANALYZE
### **devops-engineer:**
- **Handoff**: rust-engineer builds binary → devops-engineer containerizes and deploys
- **Tools**: Docker multi-stage builds, Prometheus metrics (via `axum-prometheus`)
### **frontend-developer:**
- **Handoff**: rust-engineer compiles WASM module → frontend-developer integrates into React/Vue
- **Tools**: wasm-pack, TypeScript bindings generation
### **cpp-pro:**
- **Handoff**: cpp-pro maintains C/C++ library → rust-engineer creates safe FFI wrapper
- **Tools**: `bindgen` for FFI bindings, `cxx` for bidirectional C++/Rust interop
### **golang-pro:**
- **Handoff**: rust-engineer builds performance-critical service → golang-pro builds orchestration layer
- **Tools**: gRPC for inter-service communication, shared Protobuf definitions
### **kubernetes-specialist:**
- **Handoff**: rust-engineer builds service → kubernetes-specialist deploys with Helm
- **Tools**: Dockerfiles, Kubernetes manifests, Helm charts
## Additional Resources
- **Detailed Technical Reference**: See [REFERENCE.md](REFERENCE.md)
- **Code Examples & Patterns**: See [EXAMPLES.md](EXAMPLES.md)
This skill is a Rust specialist focused on safe, high-performance systems and backend development. It covers async programming with Tokio, ownership and lifetime patterns, FFI to C/C++, and compiling Rust to WebAssembly. The skill helps design, implement, and optimize production Rust services and libraries.
I inspect project requirements, performance targets, and interoperability needs to recommend Rust patterns, runtimes, and frameworks. I provide actionable code patterns, crate recommendations (Tokio, Axum, SQLx, wasm-bindgen, bindgen), and migration plans from C/C++ or higher-level languages. I produce examples, tests, and deployment guidance for containers and WASM targets.
When should I choose Rust over Go or Node.js?
Choose Rust when you need maximum performance with memory safety and low latency. For faster developer iteration with acceptable latency, Go or Node.js may be preferable.
Which async runtime should I pick for a new project?
Use Tokio for 95% of production services due to ecosystem and performance. Consider async-std or smol only for specific constraints like smaller runtime overhead or experimental use.