rust-best-practices

rust-best-practices is a skill for Claude Code, Codex from kabudu/engineering-agent-skills. It costs 52 tokens per session (1,242 once invoked), scanned A, original, MIT.

A guide for implementing, refactoring, or debugging Rust code while preserving its interfaces, error behaviour, safety, and supported toolchains. Rust is a programming language with strict rules for memory ownership and types.

In plain words
What is it for?
Use it for substantive Rust code changes, including implementation, refactoring, and bug fixes.
Why use it?
It reduces compatibility and safety mistakes by checking the surrounding code, tests, build settings, and public behaviour before changes are made.

Skill for Claude CodeCodex

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

Good fit Use it for substantive Rust code changes, including implementation, refactoring, and bug fixes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kabudu/engineering-agent-skills/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 kabudu/engineering-agent-skills --skill rust-best-practices
Clone the repo
git clone --depth 1 https://github.com/kabudu/engineering-agent-skills

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/kabudu/engineering-agent-skills/rust-best-practices/github.svg)](https://agentmods.dev/skills/kabudu/engineering-agent-skills/rust-best-practices)
Your own site
<a href="https://agentmods.dev/skills/kabudu/engineering-agent-skills/rust-best-practices"><img src="https://agentmods.dev/badge/skills/kabudu/engineering-agent-skills/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/kabudu/engineering-agent-skills/rust-best-practices"><img src="https://agentmods.dev/badge/skills/kabudu/engineering-agent-skills/rust-best-practices.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,242 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.00052 $0.01242
Opus 5.5 $0.00021 $0.00497
Sonnet 5.5 $0.00010 $0.00248
Haiku 4.5 $0.00005 $0.00124

Measured yesterday against content hash b9890b23eae3, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 yesterday.

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-best-practices/SKILL.md · 53 lines

How it starts

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

Rust best practices

Produce idiomatic Rust that satisfies the requested behaviour and the project's contracts. Follow repository instructions, established conventions, and supported toolchains. Keep changes scoped; do not replace working architecture or introduce dependencies solely to satisfy a preference here.

Establish the contract

Read the affected code, tests, Cargo manifests, toolchain configuration, and relevant CI commands. Identify the edition, minimum supported Rust version (MSRV), deployment targets, feature combinations, and whether the changed interface has downstream consumers. A lib.rs alone does not imply a published compatibility promise.

Before refactoring, establish observable behaviour and relevant failure semantics. Preserve public signatures, errors, output, and feature behaviour unless the request authorises changes. A panic-to-error conversion can change a public signature; explain the migration rather than assuming it is compatible. Add focused regression coverage for demonstrated bugs or fragile behaviour.

Implement with explicit contracts

  • Prefer clear concrete types and direct code. Use enums or newtypes when they prevent meaningful invalid states or unit confusion; introduce traits and builders for actual variation or construction needs.
  • Borrow when reading, use mutable borrows for in-place updates, and consume by value when storing or transferring ownership. Prefer &str and slices when callers need no container-specific operations. Choose generic conversion/iterator parameters only when their flexibility earns the complexity.
  • Start with unique ownership. Use Arc, Rc, locks, and interior mutability when sharing or mutation is intentional. Their presence in an API is a design question, not automatically a defect. Before cloning to resolve a borrow conflict, consider shortening the borrow, separating disjoint state, or moving with take/replace; deliberate cheap copies are valid.
  • Use Option for normal absence, Result for expected failures, and panics for violated internal invariants. Check whether external input can violate a claimed invariant. A justified expect should explain the invariant; do not mechanically replace every unwrap or promise panic-free behaviour without evidence.
  • Preserve actionable error context and causal chains. Public error types should support the contracts callers need, normally Display and Error; require Send, Sync, or 'static when the execution/API model needs them. Prefer typed errors when callers inspect failures; error erasure can be intentional. Do not add an error framework by default.
  • Keep visibility narrow and public APIs intentional. Implement applicable standard traits and conversion conventions; use fallible conversions when validation can fail. Keep Eq, Ord, PartialOrd, and Hash consistent over the same semantic value. Derived implementations are fine when consistent with custom ones.
  • Treat public fields, trait bounds, enum variants, feature behaviour, and exposed dependency types as compatibility decisions. Follow existing API conventions; do not add sealing, non_exhaustive, or new wrappers without considering their costs.
  • Bound work and resource consumption for untrusted input. Check parser sizes, allocation growth, retries, and partial-failure cleanup where relevant; safe Rust does not prevent resource exhaustion.
  • Handle integer range and conversion semantics explicitly at trust boundaries. Choose checked, saturating, wrapping, or fallible operations according to the contract. A numeric as cast can truncate; do not confuse truncation with a panic.
  • Prefer readable iteration and pattern matching over mechanical rewrites between loops, combinators, and match. Avoid speculative abstraction and unmeasured optimisation. Keep externally visible ordering deterministic when the contract requires it.
  • Document public contracts that types cannot express: failure modes, panics, safety obligations, side effects, and meaningful ownership or complexity constraints. Examples should demonstrate realistic error handling. Follow existing documentation conventions instead of imposing a template on every private helper.

Read the full file on GitHub · 53 lines

Files

What ships with it

5 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. yesterday First seen · 53 lines · 52 tokens per session scan A b9890b23eae3

Subscribe to this mod's changes

rust-best-practices is a skill published in the GitHub repository kabudu/engineering-agent-skills (3 stars, last pushed yesterday), licensed MIT. It adds 52 tokens to every session and 1,242 once invoked, about $0.0002 per session on Opus 5.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-10-26.

Related

Other skills, from other repositories

rust-programming-expert

Expert-level skill for Rust programming (Rust 2024 / v1.88+). Covers memory safety, Grounded Permissions Model (R/W/O/F), async Axum 0.8/SQLx, CLI, and zero-cost optimization in English and Indonesian.

roedyrustam/vibes-plug · 60 tokens

tauri-expert

Expert guide for Tauri 2.x / 2.12+ cross-platform desktop and mobile development: Rust 1.90+ MSRV, IPC Channel streaming, onpermissionrequest handlers, App-Bound domains, and Capabilities security / Panduan ahli pengembangan desktop dan mobile Tauri 2.x / 2.12+.

roedyrustam/vibes-plug · 73 tokens

wasm-edge-computing-expert

Expert guide for WebAssembly (WASM) and Edge Computing. Covers WASI preview 2, Spin/Fermyon, Cloudflare Workers WASM, and high-performance browser computing / Panduan ahli untuk WebAssembly (WASM) dan Edge Computing. Mencakup WASI preview 2, Spin/Fermyon, Cloudflare Workers WASM, dan komputasi performa tinggi di…

roedyrustam/vibes-plug · 91 tokens

rewrite-rustdoc

Rewrite Rust documentation comments to ensure all documentation and comments are in English, following rustdoc guidelines. Use when the user wants to clean up Rust documentation, translate Chinese comments to English, fix missing documentation, or ensure rustdoc compliance in a Rust codebase.

jim60105/copilot-prompt · 56 tokens

migrate-to-rust

Clones, analyzes, plans, and migrates legacy codebases (C++, Fortran, Java, Python, C, Shell) from a GitHub URL or local directory to a modern, high-performance, deterministic, 100% Safe Rust architecture, tracking live telemetry across every task bucket, test failure/fix cycle, and Profile-Guided Optimization (PGO)…

google/skills · 166 tokens

setup-ts-deep-modules

A TypeScript repository setup that keeps each package's internal code private behind root-level entry files. A package is a reusable unit of code, and an entry point is the file other code is meant to import.

vinvcn/mattpocock-skills-zh-CN · 49 tokens