actionbook avatar

Coding Guidelines

Rust style and best-practice rules covering naming, data types, strings, errors, memory, concurrency, and async.

skills.sh installs
4.3K
GitHub stars
1.6K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers naming conventions, newtypes, string handling, error propagation, memory and lifetimes, concurrency, async, and macros
  • Includes a table of deprecated crates and std items with their replacements, such as lazy_static! to std::sync::OnceLock
  • Enforces rules like no get_ prefix, as_/to_/into_ conversion naming, and ? instead of try!()
  • Designed for Claude to consult on Rust naming, formatting, and code review questions beyond common conventions

Install

$ npx -y skills add actionbook/rust-skills --skill coding-guidelines -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Rust Coding Guidelines (50 Core Rules)

Naming (Rust-Specific)

RuleGuideline
No get_ prefixfn name() not fn get_name()
Iterator conventioniter() / iter_mut() / into_iter()
Conversion namingas_ (cheap &), to_ (expensive), into_ (ownership)
Static var prefixG_CONFIG for static, no prefix for const

Data Types

RuleGuideline
Use newtypesstruct Email(String) for domain semantics
Prefer slice patternsif let [first, .., last] = slice
Pre-allocateVec::with_capacity(), String::with_capacity()
Avoid Vec abuseUse arrays for fixed sizes

Strings

RuleGuideline
Prefer bytess.bytes() over s.chars() when ASCII
Use Cow<str>When might modify borrowed data
Use format!Over string concatenation with +
Avoid nested iterationcontains() on string is O(n*m)

Error Handling

RuleGuideline
Use ? propagationNot try!() macro
expect() over unwrap()When value guaranteed
Assertions for invariantsassert! at function entry

Details

Repository
github.com/actionbook/rust-skills
Category
Rust
First seen
May 16, 2026

More from actionbook/rust-skills

All 38

Similar to Coding Guidelines

More Rust