Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
zhanghandong avatar

Coding Guidelines

  • 1.3k installs
  • 1.3k repo stars
  • Updated May 24, 2026
  • zhanghandong/rust-skills

This is a copy of coding-guidelines by actionbook - installs and ranking accrue to the original listing.

coding-guidelines is a Rust agent skill that enforces idiomatic, Clippy-aligned patterns and safety documentation for developers using Claude or Cursor on Rust codebases.

About

coding-guidelines is a Rust-focused skill from zhanghandong/rust-skills that maps common Clippy lints to concrete fixes agents should apply while authoring code. The reference table covers error handling (unwrap_used), performance (needless_clone, linkedlist, large_stack_arrays), async pitfalls (await_holding_lock), style (wildcard_imports, too_many_arguments), and unsafe requirements (missing_safety_doc, undocumented_unsafe_blocks, transmute_ptr_to_ptr). Developers reach for it when they want generated Rust to match community norms instead of fighting Clippy in review. It pairs with the unsafe-checker skill for deeper unsafe audits.

  • 50 core Rust coding rules covering naming, formatting, comments, safety and performance
  • Direct Clippy lint → rule mapping with recommended fixes for 10 frequent lints
  • Explicit guidance on unsafe blocks, iterator conventions, and avoiding get_ prefixes
  • Links to full 500+ rule reference for deeper Rust style decisions
  • Designed as a hard reference before code review or agent code generation

Coding Guidelines by the numbers

  • 1,260 all-time installs (skills.sh)
  • +9 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
npx skills add https://github.com/zhanghandong/rust-skills --skill coding-guidelines

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1.3k
repo stars1.3k
Security audit3 / 3 scanners passed
Last updatedMay 24, 2026
Repositoryzhanghandong/rust-skills

How do you write idiomatic Rust with Claude?

Get consistent, idiomatic Rust code that follows community standards and avoids common pitfalls when working with Claude or Cursor.

Who is it for?

Developers using AI assistants on Rust services or CLIs who want Clippy-clean, idiomatic output on the first pass.

Skip if: Teams working only in non-Rust stacks or projects that already enforce identical rules through custom rustfmt/clippy.toml automation.

When should I use this skill?

The user asks for Rust code, Clippy fixes, idiomatic patterns, or unsafe documentation in a Rust crate.

What you get

Clippy-aligned Rust patches, documented unsafe blocks, and consistent import and API shapes

  • idiomatic Rust source
  • documented unsafe blocks
  • Clippy-aligned refactors

By the numbers

  • Documents fixes for at least 10 named Clippy lints in the reference table

Files

SKILL.mdMarkdownGitHub ↗

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

Memory

RuleGuideline
Meaningful lifetimes'src, 'ctx not just 'a
try_borrow() for RefCellAvoid panic
Shadowing for transformationlet x = x.parse()?

Concurrency

RuleGuideline
Identify lock orderingPrevent deadlocks
Atomics for primitivesNot Mutex for bool/usize
Choose memory order carefullyRelaxed/Acquire/Release/SeqCst

Async

RuleGuideline
Sync for CPU-boundAsync is for I/O
Don't hold locks across awaitUse scoped guards

Macros

RuleGuideline
Avoid unless necessaryPrefer functions/generics
Follow Rust syntaxMacro input should look like Rust

Deprecated → Better

DeprecatedBetterSince
lazy_static!std::sync::OnceLock1.70
once_cell::Lazystd::sync::LazyLock1.80
std::sync::mpsccrossbeam::channel-
std::sync::Mutexparking_lot::Mutex-
failure/error-chainthiserror/anyhow-
try!()? operator2018

Quick Reference

Naming: snake_case (fn/var), CamelCase (type), SCREAMING_CASE (const)
Format: rustfmt (just use it)
Docs: /// for public items, //! for module docs
Lint: #![warn(clippy::all)]

Claude knows Rust conventions well. These are the non-obvious Rust-specific rules.

Related skills

How it compares

Use coding-guidelines for day-to-day idiomatic generation; pair unsafe-checker when changes touch unsafe or FFI-heavy code.

FAQ

Which Clippy lints does coding-guidelines cover?

coding-guidelines maps lints including unwrap_used, needless_clone, await_holding_lock, linkedlist, wildcard_imports, missing_safety_doc, undocumented_unsafe_blocks, transmute_ptr_to_ptr, large_stack_arrays, and too_many_arguments to concrete Rust fixes.

Does coding-guidelines handle unsafe Rust?

coding-guidelines requires # Safety docs and // SAFETY: comments for unsafe blocks and points unsafe-heavy reviews to the companion unsafe-checker skill for deeper checks.

Code Review & Qualitybackendtestingdocs

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.