rust

Diagnoses and repairs Rust ownership, async cancellation, unsafe FFI, and Cargo feature defects.

22|Updated Sep 10, 2026
One-click install
npx skills add https://github.com/Lynricsy/HyperSkills --skill rust-lynricsy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust
Source: https://github.com/Lynricsy/HyperSkills/tree/main/skills/rust
Command: npx skills add https://github.com/Lynricsy/HyperSkills --skill rust-lynricsy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Rust code often compiles in one configuration while hiding real defects: values lost on async cancellation, unsound safe wrappers over raw pointers, and crates that only build because a workspace sibling enables a missing feature. This Skill provides contract-driven workflows to find and fix those boundary failures instead of papering over compiler errors. ## Core Features & Use Cases - Ownership and error contracts: Design signatures around explicit owner, borrower, and destruction points, with error types that preserve retryable inputs and recovery identity. - Async lifecycle diagnosis: Trace Tokio cancellation, task supervision, Send/Sync bounds, and lock lifetimes to fix lost work, stalls, and detached tasks. - Unsafe and FFI proof review: Audit safe wrappers, raw-slice construction, foreign callbacks, and allocator pairing against documented validity obligations. - Cargo compatibility repair: Fix feature unification defects with isolated consumer builds and verify edition, resolver, and MSRV promises on the declared toolchain. - Use Case: A queue-admission helper silently drops a non-cloneable job when cancellation races a full channel; the Skill guides restructuring the API around Sender::reserve so the original value is returned on cancellation, with tests proving it. ## Quick Start Ask the agent to review your Rust file for cancellation safety, unsafe soundness, or Cargo feature issues, for example: review this Tokio enqueue function and make sure cancellation returns the unsent job to the caller.

Frequently Asked Questions about rust

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

FAQPage Schema
How do I fix a Tokio task that loses work on cancellation?

Map each await to the state its future owns and identify which value is dropped when another select branch wins. Keep non-cloneable values outside the cancellable send future, use Sender::reserve to acquire capacity, and transfer ownership only at a defined acceptance point.

How do I make a safe Rust wrapper over a raw pointer sound?

A safe wrapper must prevent undefined behavior for every safe caller; nullness and length checks alone cannot prove allocation, initialization, aliasing, or lifetime. Keep an unsafe boundary with a precise # Safety contract, or tie returned borrows to a real owner that enforces the foreign lifetime.

Why does cargo check -p mycrate fail while cargo check --workspace passes?

Feature unification on a shared normal dependency lets a sibling crate's enabled features mask your crate's missing declaration. Use cargo tree -e features -i to find the activation edge, then declare the required feature on your own dependency and verify with an isolated build.

Does dropping a Tokio JoinHandle cancel the spawned task?

No, dropping a JoinHandle detaches the task, which keeps running independently. Retain the handle under an owner whose shutdown path awaits it, and treat join errors separately from the task's application-level Result.

Can Miri verify my FFI code with a C library?

Miri checks supported Rust-side memory operations but does not execute arbitrary foreign code. Combine Miri for the Rust boundary with real C-side integration tests for layout, callbacks, allocator pairing, and unwind behavior, and record obligations no tool can establish.

When should I not use this Rust skill?

It does not cover Tauri capabilities and plugin configuration, smart-contract semantics, or a web framework's routing APIs; those belong to their own domains. Use it only for concrete Rust ownership, async runtime, unsafe, or Cargo build-contract issues.