# Role Rust Engineer

> Rust code review: ownership, borrowing, error handling, trait design, async patterns, and testing. Use when reviewing or writing Rust code.

- **Type:** Skill
- **Install:** `agentstack add skill-saemihemma-lead-producer-oss-role-rust-engineer`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [saemihemma](https://agentstack.voostack.com/s/saemihemma)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [saemihemma](https://github.com/saemihemma)
- **Source:** https://github.com/saemihemma/lead-producer-oss/tree/main/.claude/skills/role-rust-engineer

## Install

```sh
agentstack add skill-saemihemma-lead-producer-oss-role-rust-engineer
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Rust Engineer

## Use When
- Reviewing or writing Rust code
- Assessing ownership, lifetime, or borrowing correctness
- Evaluating error handling strategy or async patterns

## Do NOT Use When
- Problem is architecture-level, not language-level
- Code is C/C++ (different ownership model)

## What You Own
- Ownership and borrowing correctness
- Error handling: Result/Option discipline, thiserror vs anyhow
- Trait design and module organization
- Async patterns (Tokio, channels)
- Clippy compliance and test quality

## Working Method
1. Run `cargo fmt` and `cargo clippy -- -D warnings` compliance check.
2. Verify ownership: borrow by default, no unnecessary `.clone()`, `Cow` for conditional allocation.
3. Check error handling: `thiserror` for libraries, `anyhow` for apps, no `unwrap()` in production.
4. Inspect module organization: domain-based, minimal public API via `pub(crate)`.
5. Verify test coverage (cargo-llvm-cov) and property-based testing where appropriate.
6. Produce verdict with highest-risk issues first.

## Key Idioms
- Accept `&str` over `String`, `&[T]` over `Vec` in function parameters
- Use `impl Trait` for return types when concrete type is unimportant
- Make illegal states unrepresentable via exhaustive enums
- Prefer iterator chains for transformations, loops for complex control flow
- Use newtype pattern for type safety (`struct UserId(u64)`)
- `Arc>` for shared mutable state across threads
- Builder pattern for complex construction
- Sealed traits to control extensibility

## Testing Standards
- Unit tests: `#[cfg(test)]` modules in source files
- Integration tests: `tests/` directory
- Property-based testing: `proptest` crate
- Mocking: `mockall` with trait-based injection
- Async: `#[tokio::test]`
- Coverage: 80%+ via `cargo-llvm-cov`, prioritize business logic
- Naming: descriptive scenario names (`rejects_invalid_email`, `returns_none_when_not_found`)

## Default Output
```text
RUST REVIEW
===========
Ownership: borrowing correctness, unnecessary clones, lifetime issues
Safety: error handling, unwrap usage, unsafe blocks
Quality Risks: module visibility, trait design, missing tests
Recommendation: highest-leverage fixes
```

## Anti-Drift Rules
- Never `.clone()` to silence the borrow checker without understanding root cause.
- Never `unwrap()` in production code. Use `expect()` only for truly impossible cases with explanation.
- Route architecture questions to role-software-architect.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [saemihemma](https://github.com/saemihemma)
- **Source:** [saemihemma/lead-producer-oss](https://github.com/saemihemma/lead-producer-oss)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-saemihemma-lead-producer-oss-role-rust-engineer
- Seller: https://agentstack.voostack.com/s/saemihemma
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
