rust

Production Rust development guidance focused on data ownership, lifetimes, concurrency, and common compiler errors. Rust is a systems programming language that checks memory use and data sharing while compiling code.

In plain words
What is it for?
Use it when writing Rust web services, command-line tools, embedded software, or concurrent code using patterns such as Arc, Mutex, and RwLock.
Why use it?
It provides a method for choosing safe ownership and sharing patterns before changing code, which helps resolve borrow-checker problems and fit designs to their runtime needs.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/neverinfamous/memory-journal-mcp/rust
Any agent
npx skills add neverinfamous/memory-journal-mcp --skill rust
Clone the repo
git clone --depth 1 https://github.com/neverinfamous/memory-journal-mcp

Made for: Claude Code, Codex.

Per session 94 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 856 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00094 $0.00856
Opus 5 $0.00047 $0.00428
Sonnet 5 $0.00019 $0.00171
Haiku 4.5 $0.00009 $0.00086

Measured 3d ago against content hash b64c544c0b84, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

rust 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 3d 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.

skills/rust/SKILL.md · 77 lines

How it starts

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

Rust Development & Meta-Cognition

When solving Rust problems, do not immediately write code. Trace through the cognitive layers first to understand the data's lifecycle, ownership, and constraints.

🧠 1. The Meta-Cognition Framework (Before You Code)

Layer 1: Domain Constraints (WHY)

What is the system trying to achieve?

  • Web Service: Concurrent, async, low-latency (Often uses axum, tokio, Arc<Mutex<T>>).
  • CLI Tool: Fast startup, zero overhead, clean exit codes (Often uses clap, anyhow, strict error formatting).
  • Embedded / Systems: No heap allocation (Requires no_std, specific hardware limitations).

Layer 2: Design Choices & Ownership (WHAT)

Ask the core question: Who should own this data?

  • Single owner, strictly unique: Direct value or Box<T>.
  • Single thread, multiple owners: Rc<T> (use RefCell<T> for mutation).
  • Multi-thread, multiple owners: Arc<T> (use Mutex<T> or RwLock<T> for mutation).

Why does it need to mutate? Avoid slapping mut everywhere. Prefer returning new values or using tight, scoped mutability.

Layer 3: Language Mechanics (HOW)

Use the compiler's strictness as a tool, not an obstacle.

  • Implement standard traits: Drop, Clone, Default, Display, From, TryFrom.
  • Avoid unwrap() or expect() in production logic. Propagate errors natively via ? and Result.

🏗️ 2. Core Ecosystem Defaults

Consult references/ecosystem.md for canonical community crates.


🛡️ 3. Solving Borrow Checker Errors

Consult references/borrow-checker.md for diagnostics and resolution paths for common compiler errors (E0382, E0596, E0499).


⚡ 4. High-Integrity Code Patterns

  1. Avoid Panic-Driven Development: clone() is an acceptable escape hatch during prototyping, but do not scatter it throughout the code. Revisit the lifetime boundaries as soon as it works.
  2. The Newtype Pattern: Use tuple structs to prevent invalid state. struct UserId(u64); avoids mixing it up with struct OrderId(u64);.
  3. Exhaustive Matching: Prefer match over if let when handling Enums or State Machines. The compiler will notify you when a new variant is added, preventing silent bugs.
  4. Data-Oriented Modeling: Prefer small, flat structs that compose over deep, object-oriented inheritance hierarchies.

Read the full file on GitHub · 77 lines

Files

What ships with it

2 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. 3d ago First seen · 77 lines · 94 tokens per session scan A b64c544c0b84

Subscribe to this mod's changes

rust is a skill published in the GitHub repository neverinfamous/memory-journal-mcp (20 stars, last pushed 1mo ago), licensed MIT. It adds 94 tokens to every session and 856 once invoked, about $0.0005 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

copyright-headers

Ensure every Rust (.rs) file in Wassette starts with the required Microsoft copyright header, using the idempotent scripts/copyright.sh helper. Use when adding new Rust files or when a copyright-header check fails.

microsoft/wassette · 47 tokens

rust-code-style

Write idiomatic, well-structured Rust for Wassette — single-responsibility design, anyhow error handling, Arc/Mutex for shared state, and the required formatting and linting with cargo +nightly fmt, cargo clippy, and cargo machete. Use when adding or refactoring Rust code in this repository.

microsoft/wassette · 68 tokens

update-keyboard-shortcuts

Audits and synchronizes keyboard shortcuts across docs/keyboardshortcuts.md, crates/regenerator2000-tui/src/ui/dialogkeyboardshortcut.rs, crates/regenerator2000-tui/src/ui/menu.rs, and the view files (viewdisassembly.rs, viewhexdump.rs, viewcharset.rs, viewbitmap.rs, viewblocks.rs, viewsprites.rs).

ricardoquesada/regenerator2000 · 81 tokens

coding

Skill "coding" from ricardoquesada/regenerator2000, covering 6502 disassembler expert skills, core context, technical requirements, 1. 6502 logic and 2. rust performance & safety.

ricardoquesada/regenerator2000 · 0 tokens

rust-best-practices

Rust coding best practices for cc-audit development. Use when writing new Rust code, reviewing code, or refactoring. Covers error handling, safety, performance, and idiomatic patterns.

ryo-ebata/cc-audit · 43 tokens

rust-modern-style

Apply rag-rat's Rust style when writing or reviewing Rust: current stable idioms, module-qualified free functions and constants, explicit persistence contracts, and narrow APIs.

cq27-dev/rag-rat · 37 tokens