rust

Identify and codify Rust ownership and borrowing patterns for safer code.

Updated Sep 16, 2025
One-click install
npx skills add https://github.com/singh-gur/opencode --skill rust-singh-gur
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust
Source: https://github.com/singh-gur/opencode/tree/main/skills/rust
Command: npx skills add https://github.com/singh-gur/opencode --skill rust-singh-gur

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Rust developers often struggle with ownership, borrowing rules, and error handling, leading to unsafe or hard-to-maintain code. This guide consolidates idiomatic patterns and practical guidance to build robust Rust software.

Core Features & Use Cases

  • Ownership and borrowing explained with concrete examples to prevent common pitfalls
  • Error handling strategies including anyhow, thiserror, and graceful propagation patterns
  • Idiomatic patterns such as Newtype, Builder, and Type-State, plus clear module organization for scalable projects
  • Performance considerations, testing practices, and production-readiness guidance for Rust code

Quick Start

Explain a simple ownership example in Rust showing move and borrow without violating rules.

Frequently Asked Questions about rust

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

FAQPage Schema
How do I fix Rust ownership and borrowing errors when designing module APIs?

Fix Rust ownership and borrowing errors by applying idiomatic patterns like move and borrow to enforce safe API boundaries. This prevents common pitfalls and improves code clarity without violating ownership rules.

What is the best way to handle errors in Rust production code?

The best way to handle errors in Rust production code is using error handling strategies like anyhow and thiserror. These crates provide graceful propagation patterns to ensure robust, maintainable software.

When do I need to use idiomatic Rust patterns like Newtype and Builder?

Use idiomatic Rust patterns like Newtype and Builder when organizing scalable projects and defining clear module boundaries. They codify common structures to improve code safety and maintainability.

Does this Rust guide cover performance optimization and testing practices?

Yes, this Rust guide covers performance considerations and testing practices. It provides production-readiness guidance to optimize Rust code while maintaining safe borrowing and error handling strategies.

Why does my Rust code fail to compile when passing variables between functions?

Rust code fails to compile when passing variables because of strict ownership rules. Variables are moved by default, so you must use references and borrowing patterns to pass data without transferring ownership.