rust

Identify and mitigate common production Rust pattern mistakes in AI-generated code.

13|Updated Mar 15, 2019
One-click install
npx skills add https://github.com/WTFox/dotfiles --skill rust-wtfox
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust
Source: https://github.com/WTFox/dotfiles/tree/main/claude/.claude/skills/rust
Command: npx skills add https://github.com/WTFox/dotfiles --skill rust-wtfox

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps prevent production Rust anti-patterns that commonly appear in AI-generated code, improving safety, correctness, and performance.

Core Features & Use Cases

  • Clarifies when to use thiserror vs anyhow for error handling in libraries and applications.
  • Demonstrates how to avoid unnecessary .clone() calls by borrowing data and choosing ownership wisely.
  • Covers Tokio-based async patterns, lifetime simplification, and iterator best practices to produce robust Rust code in production.
  • Example: apply these guidelines when reviewing or generating Rust components for a service to ensure reliable error handling, ownership, and async I/O.

Quick Start

Review the guidance and apply these patterns when writing or auditing Rust code.

Frequently Asked Questions about rust

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

FAQPage Schema
How do I avoid unnecessary clone calls in Rust ownership patterns?

Avoid unnecessary clones in Rust by borrowing data and choosing ownership-oriented designs over defaulting to .clone(). This improves safety and performance by leveraging the borrow checker effectively.

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

Use thiserror for library error types to provide structured, typed errors, and anyhow for application code needing flexible error aggregation. This distinction ensures robust Rust error handling.

What are the best non-blocking async patterns for Tokio in Rust?

The best Tokio async patterns employ non-blocking I/O, simplify lifetimes, and avoid blocking operations within async contexts. These patterns ensure robust async Rust code in production.

Why does AI-generated Rust code often fail the borrow checker?

AI-generated Rust code often fails the borrow checker by applying unnecessary clones and improper lifetime management. Mitigate these production anti-patterns by favoring ownership-oriented designs and borrowing.

Does this Rust guidance cover iterator and struct design best practices?

Yes, this guidance covers iterator and struct design best practices across library and application code. It specifies requirements for ownership-oriented designs to produce robust Rust components.