language-rust

Guide Rust code for ownership, borrowing, lifetimes, and error handling.

2|8|Updated Apr 20, 2026
One-click install
npx skills add https://github.com/lugassawan/swe-workbench --skill language-rust-lugassawan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: language-rust
Source: https://github.com/lugassawan/swe-workbench/tree/main/skills/language-rust
Command: npx skills add https://github.com/lugassawan/swe-workbench --skill language-rust-lugassawan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you produce correct Rust code by guiding ownership, borrowing, lifetimes, error handling, and iteration patterns that satisfy the borrow checker and idiomatic expectations.

Core Features & Use Cases

  • Ownership & Borrowing Guidance: Decide when to move values, borrow immutably, or borrow mutably to avoid design smells.
  • Lifetimes Strategy: Add lifetimes only when needed, avoid unnecessary 'static complexity, and choose owned data or Arc when lifetimes proliferate.
  • Idiomatic Error Handling: Use Result with ?, choose thiserror for libraries or anyhow for applications, and attach context for debuggability.
  • Traits & Dispatch Choices: Prefer capability-based trait design and select impl Trait vs dyn Trait appropriately.
  • Iterator-First Implementation: Use iterator chains instead of indexed loops, and choose iter()/into_iter()/iter_mut() based on intent.
  • Async Rust Guardrails: Select a runtime (typically tokio), avoid blocking, and design for Send + 'static where required.

Quick Start

Use the language-rust skill to refactor your .rs code so it compiles cleanly and follows idiomatic ownership, borrowing, lifetimes, and Result-based error handling.

Frequently Asked Questions about language-rust

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix borrow checker errors when refactoring Rust code?

To fix borrow checker errors in Rust, analyze ownership and borrowing to decide when to move values, borrow immutably, or borrow mutably, eliminating design smells and satisfying the compiler.

What's the best way to handle errors in Rust using Result and the question mark operator?

The best way to handle errors in Rust is idiomatic error handling using `Result` with the `?` operator, choosing `thiserror` for libraries or `anyhow` for applications, and attaching context for debuggability.

When do I need explicit lifetimes in Rust function signatures?

You need explicit lifetimes in Rust function signatures only when the compiler cannot infer them, avoiding unnecessary `'static` complexity and choosing owned data or `Arc` when lifetimes proliferate.

Should I use impl Trait or dyn Trait for trait dispatch in Rust?

You should choose `impl Trait` or `dyn Trait` for dispatch in Rust based on whether you need static or dynamic dispatch, preferring capability-based trait design to define clear behavioral contracts.

How do I avoid blocking in async Rust tasks using tokio?

To avoid blocking in async Rust tasks using `tokio`, select the runtime appropriately, design tasks for `Send + 'static` where required, and ensure non-blocking execution within your async workflows.

When should I use iterator chains instead of indexed loops in Rust?

You should use iterator chains instead of indexed loops in Rust to write idiomatic code, choosing `iter()`, `into_iter()`, or `iter_mut()` based on your intent for safe and efficient collection processing.