power-rust

Applies five prompt patterns that reduce common bugs in LLM-generated Rust code.

2|Updated May 16, 2026
One-click install
npx skills add https://github.com/avbel/ai-skills --skill power-rust-avbel
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: power-rust
Source: https://github.com/avbel/ai-skills/tree/main/skills/power-rust
Command: npx skills add https://github.com/avbel/ai-skills --skill power-rust-avbel

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? LLM-generated Rust repeatedly contains the same classes of bugs: version-mismatched crate APIs, cancel-unsafe async code, unjustified unsafe blocks, broken lifetime signatures, and poorly designed trait hierarchies. This Skill provides five concrete prompt patterns, distilled from a six-month benchmark of LLM Rust output, that statistically reduce these errors when writing or reviewing AI-generated Rust. ## Core Features & Use Cases - Version and runtime pinning: Require exact crate versions and async runtime (e.g., axum 0.7, tokio 1.35) in every prompt to prevent API averaging across incompatible releases. - Cancel-safety and SAFETY annotations: Force per-function // cancel-safe: comments on async fns and // SAFETY: invariant lists on every unsafe block, creating a mechanical audit trail. - Lifetime call-site examples and trait design checkpoints: Demand example call sites before committing to non-trivial lifetime signatures, and require 2-3 candidate trait designs with object-safety and blanket-impl analysis before implementation. - Use Case: When asking a coding agent to write an HTTP handler, you specify "axum 0.7, tokio 1.35, sqlx 0.7 with postgres" and require cancel-safety annotations, catching a parking_lot::Mutex held across .await before it ships. ## Quick Start Ask your coding agent to write Rust using the power-rust prompt patterns, pinning crate versions and requiring cancel-safety and SAFETY annotations on the generated code.

Frequently Asked Questions about power-rust

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

FAQPage Schema
How do I reduce bugs in AI-generated Rust code?▼

Pin exact crate versions and the async runtime in every prompt, require cancel-safety annotations on each async fn, and demand SAFETY comments on unsafe blocks. These prompt patterns measurably reduced error rates in a six-month benchmark of LLM Rust output.

How to write prompts for LLM Rust code generation?▼

State the exact major.minor version of every direct dependency, the async runtime and its version, and relevant feature flags, such as "axum 0.7, tokio 1.35, sqlx 0.7 with postgres". Without version anchors, models average across incompatible APIs.

What is cancel-safety in tokio async Rust?▼

Cancel-safety describes whether an async fn is safe to drop mid-future at an await point, and it has no signature marker. For example, tokio's AsyncReadExt::read is cancel-safe while read_exact is not, so each async fn should carry an explicit annotation naming the await point.

Should I enable clippy pedantic lints for AI-generated Rust?▼

Yes, the Skill mandates clippy::pedantic at deny level for crates containing LLM-generated Rust, configured via [lints.clippy] in Cargo.toml. Pedantic lints catch residual mistakes like needless borrows, mis-sized integer casts, and redundant clones.

When should I use miri to check Rust unsafe code?▼

Run miri in nightly CI when code uses unsafe, FFI, or transmute, since it catches undefined behavior like uninitialized reads and pointer-provenance violations that clippy cannot see. cargo-careful is a lighter alternative when miri is too slow.