rust-conventions
Skill0 starsChanged 30 days agoMITView on GitHub
Apply personal Rust coding conventions when adding or substantially rewriting Rust code. Do not use to enforce style on unchanged code.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- static-web-server/static-web-servertheir own version, first seen Nov 9, 2026
- leroyguillaume/claudetheir own version, first seen Oct 30, 2026
- flntfnd/claude-skillstheir own version, first seen Aug 20, 2026
- fielding/skillstheir own version, first seen Jul 2, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- static-web-server/static-web-server★ 2.4ksame name
- leroyguillaume/claude★ 7same name
- fielding/skills★ 1same name
- flntfnd/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository2 other files it gives its agents.
- github-conflictsSkill
- review-loopSkill
The file
We split this skill into the rules it gives an agent
9 rules. 0 are common, 3 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 19
Place use imports before mod foo.
- Distinctive: line 26
Prefer imports that keep module bodies readable.
- Distinctive: line 28
Do not wait for a name to occur multiple times before importing it.
- Very specific: line 30
Import distinctive types directly, such as Path, HashMap, Arc, Duration, and PhantomData.
- Very specific: line 33
Import utility modules such as io, fs, env, and process when useful.
- Very specific: line 34
Keep meaningful qualifiers such as io::Result, io::Error, io::ErrorKind, and fs::read_to_string, rather than importing every member …
- Distinctive: line 51
Keep fully qualified paths when they improve clarity.
- Very specific: line 93
When practical, functions and methods that accept a filesystem path should use a generic parameter bounded by AsRef<Path> instead of &Path, …
- Very specific: line 99
When deriving any of the following traits, use this relative order: Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Display, …
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Rust conventions
Apply these preferences only to code you add or substantially rewrite, unless repository instructions specify otherwise. Do not flag or change existing code solely to enforce them, including code copied or moved unchanged.
Modules
For modules with submodules, prefer foo.rs over foo/mod.rs.
Place use imports before mod foo; declarations; preserve any ordering
required by macros.
Imports
Choosing what to import
Prefer imports that keep module bodies readable. Import a commonly used type or trait directly, or import its module when that gives a useful short qualifier. Do not wait for a name to occur multiple times before importing it.
- Import distinctive types directly, such as
Path,HashMap,Arc,Duration, andPhantomData. PreferPathoverstd::path::Pathorpath::Pathin signatures and expressions. - Import utility modules such as
io,fs,env, andprocesswhen useful. Keep meaningful qualifiers such asio::Result,io::Error,io::ErrorKind, andfs::read_to_string, rather than importing every member directly. This can coexist with direct imports such asFile,Read, andWrite: usefs::{self, File}orio::{self, Read}. - For formatting implementations, prefer
fmt::{self, Formatter}and writeFormatterandfmt::Result. ImportDisplayorDebugdirectly when useful. - Apply the same readability criterion to external crates and local modules. A
module qualifier can distinguish related APIs, as in
mpsc::Senderandoneshot::Sender, or identify a domain, as inimage::Error. - For traits needed only for method resolution, prefer
as _when their name is otherwise unnecessary, e.g.use anyhow::Context as _;oruse std::fmt::Write as _;. Keep named imports for traits used in bounds or implementations.
Resolve collisions, including with derive macros, with a meaningful module
qualifier or descriptive alias, such as error::Error or Error as StdError.
Keep fully qualified paths when they improve clarity; occasional utility calls
and derive macro paths need not all become imports. Import only what is used.
For example:
use std::{fs, io, path::Path};
fn read_config<P: AsRef<Path>>(path: P) -> io::Result<String> {
fs::read_to_string(path)
}Grouping and layout
- For imports from the current module, prefer
use self::foooveruse foo. - Organize imports into three groups: standard library (
std,core,alloc), external crates, and local imports (self,super,crate), in that order. Separate groups with a blank line. - Within each group, combine imports from the same crate into a single
usedeclaration, using nested brace trees to factor out shared path prefixes. Apply the same grouping to local imports sharing acrate,self, orsuperroot. Keep imports with different visibility or attributes separate.
For example:
use std::sync::{
atomic::{AtomicI64, Ordering},
Arc, Mutex,
};
use crate::{
config::{Config, Mode},
input::Reader,
output::{Format, Writer},
storage::Store,
};Path parameters
When practical, functions and methods that accept a filesystem path should use a
generic parameter bounded by AsRef<Path> instead of &Path, especially in
public APIs. Use path.as_ref() inside the body when a &Path is needed.
Derives
When deriving any of the following traits, use this relative order: Copy,
Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Display,
Default. Place any other derived traits after these, with traits from external
crates (e.g. Serialize, Deserialize) first, followed by traits from the
local crate (e.g. CrateSpecificTrait).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

