zhanghandong avatar

Coding Guidelines

The coding-guidelines skill provides developers with Rust-specific code style standards and best practices, covering naming conventions, data types, error handling, memory management, concurrency, and async patterns. It serves Rust programmers who need guidance on naming conventions, code formatting, and adherence to Rust idioms during code review and development. The skill solves the problem of inconsistent code style and suboptimal practices by offering a centralized reference to the 50 core rules from the official Rust Coding Guidelines.

skills.sh installs
1.2K
GitHub stars
1.3K
last updated
Jul 14, 2026

Install

$ npx -y skills add zhanghandong/rust-skills --skill coding-guidelines --agent claude-code

Installs into .claude/skills of the current project.

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

Sponsors

Details

Repository
github.com/zhanghandong/rust-skills
Category
Rust

More from zhanghandong/rust-skills

All 34

Recommended

More Rust
1zhanghandong avatarm10-performancezhanghandong/rust-skillsm10 performance895skills.sh installs
2zhanghandong avatarm07-concurrencyzhanghandong/rust-skillsm07 concurrency844skills.sh installs
3zhanghandong avatarm06-error-handlingzhanghandong/rust-skillsm06 error handling827skills.sh installs
4zhanghandong avatarm04-zero-costzhanghandong/rust-skillsm04 zero cost789skills.sh installs
5zhanghandong avatarm05-type-drivenzhanghandong/rust-skillsm05 type driven786skills.sh installs
6zhanghandong avatarm13-domain-errorzhanghandong/rust-skillsm13 domain error738skills.sh installs