rust

Enforce safe Rust practices by banning unwrap and promoting idiomatic error handling.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/plutowang/term.conf --skill rust-plutowang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust
Source: https://github.com/plutowang/term.conf/tree/main/opencode/skills/inventory/rust
Command: npx skills add https://github.com/plutowang/term.conf --skill rust-plutowang

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams enforce safe Rust coding practices by banning unwrap and encouraging idiomatic error handling, leading to more robust and maintainable code.

Core Features & Use Cases

  • Enforces avoiding unwrap() and promotes ? propagation and .expect() with clear messages.
  • Fosters use of Iterators and functional style over traditional for-loops for performance and clarity.
  • Provides guidelines for async Rust using tokio, proper error handling with anyhow or thiserror, and co-located tests.
  • Useful for code reviews, onboarding new Rust developers, and maintaining large Rust projects.

Quick Start

Create a new Rust project: cargo new sample_project --bin Replace unwraps with Result-based error handling and idiomatic iterators in main.rs. Run tests and formatting: cargo test, cargo fmt

Frequently Asked Questions about rust

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

FAQPage Schema
What is the best way to handle errors in Rust without using unwrap?

The best way to handle errors in Rust without unwrap is to use Result-based error handling with the ? operator for propagation, or use .expect() with clear messages when panicking is explicitly intended. Idiomatic error handling often utilizes crates like anyhow and thiserror to create robust, maintainable error management pipelines.

How do I write idiomatic Rust iterators instead of traditional for-loops?

Idiomatic Rust iterators replace traditional for-loops by applying functional style methods like map, filter, and collect directly to iterator sequences. This approach improves both runtime performance through zero-cost abstractions and code clarity by eliminating explicit mutable state management during iteration.

Does this Rust error handling approach work with async tokio runtimes?

Yes, this Rust error handling approach works seamlessly with async tokio runtimes. The guidelines explicitly support async Rust development using tokio, allowing you to enforce unwrap avoidance and proper Result propagation concurrently within asynchronous task workflows.

How do I ensure my Rust code passes clippy and cargo build checks?

To ensure Rust code passes clippy and cargo build checks, you must eliminate unwrap calls, enforce idiomatic error handling using anyhow or thiserror, and write co-located tests. Running cargo test and cargo fmt validates formatting and test compliance before tooling execution.

When should I use anyhow vs thiserror for Rust error handling?

Use thiserror for defining custom, library-specific error types and enums, whereas use anyhow for application-level error aggregation where specific error variants matter less. Both crates facilitate idiomatic error handling by enabling smooth ? operator propagation without requiring unwrap calls.

Can I use this Skill for onboarding new Rust developers on large projects?

Yes, you can use this Skill for onboarding new Rust developers on large projects. It enforces safe Rust practices by standardizing iterator usage, tokio async guidelines, and strict unwrap avoidance, which maintains code quality and consistency during code reviews across large teams.