rust-best-practices

rust-best-practices is a skill for Claude Code, Codex from JSK9999/ai-nexus. It costs 25 tokens per session (3,599 once invoked), scanned A, original, Apache-2.0.

A practical guide to writing Rust code, covering ownership, error handling, asynchronous programming, testing, and project structure. Rust is a programming language designed to prevent many memory-safety errors.

In plain words
What is it for?
It is for creating or reviewing Rust applications, libraries, tests, asynchronous code, and Cargo workspaces using Rust 2024 guidance.
Why use it?
It gives coding agents consistent guidance for organizing Rust projects and handling common language patterns safely.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It is for creating or reviewing Rust applications, libraries, tests, asynchronous code, and Cargo workspaces using Rust 2024 guidance.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jsk9999/ai-nexus/rust-best-practices
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add JSK9999/ai-nexus --skill rust-best-practices
Clone the repo
git clone --depth 1 https://github.com/JSK9999/ai-nexus

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for rust-best-practices

README.md
[![agentmods](https://agentmods.dev/badge/skills/jsk9999/ai-nexus/rust-best-practices/github.svg)](https://agentmods.dev/skills/jsk9999/ai-nexus/rust-best-practices)
Your own site
<a href="https://agentmods.dev/skills/jsk9999/ai-nexus/rust-best-practices"><img src="https://agentmods.dev/badge/skills/jsk9999/ai-nexus/rust-best-practices/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for rust-best-practices

Your own site · 80×15
<a href="https://agentmods.dev/skills/jsk9999/ai-nexus/rust-best-practices"><img src="https://agentmods.dev/badge/skills/jsk9999/ai-nexus/rust-best-practices.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 25 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,599 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00025 $0.03599
Opus 5 $0.00013 $0.01800
Sonnet 5 $0.00005 $0.00720
Haiku 4.5 $0.00003 $0.00360

Measured 10d ago against content hash d5b3481d2397, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

rust-best-practices scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

config/skills/rust-best-practices/SKILL.md · 555 lines

How it starts

The opening of the file, as written. The whole thing — 555 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Rust Best Practices

A comprehensive guide to writing idiomatic, safe, and performant Rust code.

Overview

This skill provides best practices for Rust development across five key areas:

  1. Ownership & Borrowing - Memory safety without garbage collection
  2. Error Handling - Robust error management with Result and Option
  3. Async Patterns - Efficient concurrent programming with async/await
  4. Testing - Unit, integration, and property-based testing strategies
  5. Project Structure - Organizing Rust projects and workspaces

Default Configuration

🚀 ALWAYS USE RUST EDITION 2024 FOR NEW PROJECTS

[package]
name = "my-project"
version = "0.1.0"
edition = "2024"
rust-version = "1.85"  # Minimum required version

For workspaces:

[workspace.package]
edition = "2024"
rust-version = "1.85"

[workspace]
resolver = "2"
members = ["crates/*"]

Why Edition 2024?

  • ✅ Native async fn in traits (no more async-trait crate!)
  • ✅ if let chains for cleaner pattern matching
  • ✅ Return position impl Trait in traits (RPITIT)
  • ✅ Improved type inference for closures and iterators
  • ✅ Better const fn capabilities for compile-time computation
  • ✅ Enhanced error messages with actionable suggestions
  • ✅ Improved lifetime elision
  • ✅ Better diagnostic attributes

See edition-2024.md for comprehensive Edition 2024 guide including:

  • Key features and improvements
  • Migration guide from Edition 2021
  • Best practices and common patterns
  • Performance optimizations
  • Security considerations

Core Principles

1. Ownership & Borrowing

Rust's ownership system ensures memory safety at compile time. Follow these principles:

Ownership Rules:

  • Each value has a single owner
  • When the owner goes out of scope, the value is dropped
  • Values can be moved or borrowed (immutably or mutably)

Best Practices:

// ✅ Good: Use references to avoid unnecessary moves
fn process_data(data: &Vec<u8>) {
    // data is borrowed, not moved
    println!("Processing {} bytes", data.len());
}

// ❌ Avoid: Taking ownership when borrowing suffices
fn process_data_bad(data: Vec<u8>) {
    println!("Processing {} bytes", data.len());
    // data is dropped here - caller can't use it anymore
}

// ✅ Good: Use mutable references for in-place modifications
fn append_data(buffer: &mut Vec<u8>, data: &[u8]) {
    buffer.extend_from_slice(data);
}

// ✅ Good: Return owned values when transferring ownership
fn create_buffer(size: usize) -> Vec<u8> {
    vec![0; size]
}

Read the full file on GitHub · 555 lines

Files

What ships with it

6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 555 lines · 25 tokens per session scan A d5b3481d2397

Subscribe to this mod's changes

rust-best-practices is a skill published in the GitHub repository JSK9999/ai-nexus (19 stars, last pushed 6mo ago), licensed Apache-2.0. It adds 25 tokens to every session and 3,599 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

rust-check

Run cargo check on the current Rust project to find compile errors.

Hmbown/CodeWhale · 15 tokens

dd-code-generation

Use pup CLI for immediate Datadog operations or generate code for integration into applications.

DataDog/pup · 16 tokens

rust-crate-ci

Load before editing any Rust crate in this repo (currently runners/swarm-sandbox-runner). Covers the mandatory local validation gate, common rustfmt/clippy pitfalls, and Windows-specific Rust correctness patterns that CI enforces but are hard to catch locally without a Windows toolchain.

ZaxbyHub/opencode-swarm · 60 tokens

Agent Browser Automation

Fast Rust-based headless browser automation CLI with Node.js fallback for AI agents, featuring navigation, clicking, typing, snapshots, and structured commands optimized for agent workflows.

PramodDutta/qaskills · 37 tokens

rust-agent-handoff

Handoff protocol for the Rust multi-agent development team (rust-architect, rust-developer, rust-testing-engineer, rust-performance-engineer, rust-security-maintenance, rust-code-reviewer, rust-cicd-devops, rust-debugger, rust-critic). Use only when orchestrating subagents via structured YAML files in .local/handoff/.…

bug-ops/zeph · 85 tokens

dcg

Destructive Command Guard - High-performance Rust hook for Claude Code that blocks dangerous commands before execution. SIMD-accelerated, modular pack system, whitelist-first architecture. Essential safety layer for agent workflows.

Dicklesworthstone/destructive_command_guard · 42 tokens