agentleFS
saemihemmasaemihemma/lead-producer-oss/.claude/skills/role-rust-engineer/SKILL.md

role-rust-engineer

Skill2 starsChanged 3 months agoMITView on GitHub

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

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 2 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run cargo fmt and cargo clippy -- -D warnings compliance check.

    line 24
  2. Very specific:

    Verify ownership: borrow by default, no unnecessary .clone(), Cow for conditional allocation.

    line 25
  3. Very specific:

    Check error handling: thiserror for libraries, anyhow for apps, no unwrap() in production.

    line 26
  4. Distinctive:

    Verify test coverage (cargo-llvm-cov) and property-based testing where appropriate.

    line 28
  5. Very specific:

    Use impl Trait for return types when concrete type is unimportant

    line 33
  6. Distinctive:

    Prefer iterator chains for transformations, loops for complex control flow

    line 35
  7. Very specific:

    Use newtype pattern for type safety (struct UserId(u64))

    line 36
  8. Very specific:

    Never .clone() to silence the borrow checker without understanding root cause.

    line 61
  9. Very specific:

    Never unwrap() in production code.

    line 62

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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<T> 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<Mutex<T>> 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

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.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.