agentleFS
BenknightdarkBenknightdark/neo-skills/skills/neo-rust/SKILL.md

neo-rust

Skill7 starsChanged 6 months agoMITView on GitHub

Use this skill when writing, refactoring, debugging, modernizing, or auditing Rust code. Trigger for .rs files, Cargo projects, Rust 2024 Edition or version-specific features (up to Rust 1.100+), ownership/borrowing/lifetime issues, Result/Option error handling, async closures, unnecessary clone/performance work, unsafe code review, or modern Rust architecture.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Write safe, maintainable, and idiomatic Rust code (targeting Rust 2021 / 2024 Editions through Rust 1.100+) by leveraging the type system, …

    line 19
  2. Very specific:

    Excessive .clone(): Do not clone just to appease the borrow checker.

    line 24
  3. Very specific:

    Unchecked .unwrap() / panic!(): Never call .unwrap() or panic!() in library or production paths.

    line 25
  4. Very specific:

    Perceive (Inventory & Version Check): Check Cargo.toml for edition ("2021" vs "2024") and rust-version (MSRV), scan .rs files, and identify …

    line 38
  5. Very specific:

    Format & Deliver: Run cargo fmt and present the output using the matching template below.

    line 44

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Neo Rust Expert

Write safe, maintainable, and idiomatic Rust code (targeting Rust 2021 / 2024 Editions through Rust 1.100+) by leveraging the type system, ownership boundaries, and modern language/Cargo conventions.

Gotchas

  • Async Mutex Across .await: std::sync::MutexGuard is not Send and cannot cross .await points. Limit the lock to an inner {} block before .await, or use tokio::sync::Mutex.
  • Excessive .clone(): Do not clone just to appease the borrow checker. Prefer borrowed parameters (&str, &[T], &T) or restructure ownership and lifetimes.
  • Unchecked .unwrap() / panic!(): Never call .unwrap() or panic!() in library or production paths; propagate errors with Result<T, E>, Option<T>, ?, or let...else.
  • Edition 2024 Unsafe Env & FFI: In Rust 2024 Edition (1.85+), std::env::set_var / remove_var are unsafe (multi-threaded data races), and FFI requires unsafe extern blocks plus #[unsafe(no_mangle | export_name | link_section)]. Prefer config injection or Command::env for child processes.
  • Edition 2024 RPIT Capture & #[expect]: Return-position impl Trait (-> impl Trait) captures all in-scope lifetimes by default in Edition 2024—use + use<'a, T> to restrict captures. Prefer #[expect(lint, reason = "...")] over #[allow(lint)] so obsolete suppressions surface as warnings.

Feature Roadmap (Rust 1.85 / 2024 Edition – 1.100.0)

  • Rust 1.85 & 2024 Edition: Native async closures (async || {}, AsyncFn*), RPIT use<..> precise capturing, Future/IntoFuture in prelude, narrower if let/tail temporary scopes, unsafe extern & #[unsafe(...)], MSRV-aware Cargo resolver.
  • Rust 1.86 – 1.93: Trait upcasting (&dyn Subtrait -> &dyn Supertrait), slice/HashMap::get_disjoint_mut, std::io::pipe, let chains (if let ... && let ...), #[unsafe(naked)], const generic _ inference, mismatched_lifetime_syntaxes lint, cargo publish --workspace.
  • Rust 1.94 – 1.99: slice::array_windows::<N>(), Cargo config include & TOML 1.1, cfg_select! macro, if let match guards, Copy range types (core::range::*), assert_matches!, default v0 symbol mangling, Layout::for_value_raw & extern "C" variadics.
  • Rust 1.100.0: Stabilized Never Type (!), std::alloc::Allocator (Box::new_in, Vec::new_in), std::mem::DropGuard (new, dismiss), bool::toggle / Vec::from_fn / str::trim_prefix, Cargo min-publish-age & cargo::unused_dependencies.

Workflow

  1. Perceive (Inventory & Version Check): Check Cargo.toml for edition ("2021" vs "2024") and rust-version (MSRV), scan .rs files, and identify the task type (feature development, refactoring, or code review).
  2. Reason (Dynamic Reference Routing): Load only the reference docs needed for the task:
    • Architecture, Design & Modern Rust APIs: Load patterns.md.
    • Code Review, Refactoring & Pitfall Fixes: Load anti-patterns.md.
    • Naming, Project Layout, Cargo & Toolchain Setup: Load coding-style.md.
  3. Act & Validate (Compile & Clippy Loop): Implement changes matching the target edition/MSRV, then run cargo check and cargo clippy --all-targets -- -D warnings. Inspect compiler diagnostics and iterate until zero warnings remain.
  4. Format & Deliver: Run cargo fmt and present the output using the matching template below.

Output Templates

Template A: Code Review Report

# Rust Code Review Report

## 1. Executive Summary
* **Score**: [1-10 rating]
* **Summary**: [Overall feedback on code quality, ownership usage, and error handling]

## 2. Findings
> [!IMPORTANT]
> Order findings by severity (Error > Warning > Info).

* **[Severity] Location: `src/main.rs:L12` - [Finding Title]**
  * **Description**: [Why is this an issue? Which Rust best practice is violated?]
  * **Recommendation**:
    ```rust
    // Idiomatic Rust example demonstrating the fix
    ```

## 3. Top 3 Recommendations
1. [First actionable improvement]
2. [Second actionable improvement]
3. [Third actionable improvement]

Template B: Implementation & Refactoring Summary

# Rust Implementation / Refactoring Summary

## 1. Overview of Changes
[Briefly summarize what Rust modules, structs, or traits were added or refactored]

## 2. Applied Design Patterns & Best Practices
* [e.g., Applied `let` chains and `array_windows` for safe, flat logic]
* [e.g., Replaced `.clone()` with `&str` for zero-copy borrowing]

## 3. Local Verification Results
- [x] `cargo check` passed
- [x] `cargo clippy` passed with zero warnings
- [x] `cargo fmt` completed successfully

## 4. Next Steps
1. [Recommended next action, e.g., run `cargo test`]
2. [Other relevant suggestions]

Documentation

Official References

Internal References

  • Rust Design Patterns & Modern 1.85–1.100+ Idioms
  • Rust Anti-Patterns, Hazards & Modernization Fixes
  • Rust Coding Style, Toolchain & Cargo Standards

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.