rust-pattern
Skill1 starsChanged 6 months agoMITView on GitHub
ProcessFork's Rust idioms — Result propagation, tokio async, tracing instrumentation, error typing.
In this repository5 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- kvcache-formatSkill
- napi-bindingSkill
- pyo3-bindingSkill
- test-harnessSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 0 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Never unwrap() / expect() outside #[cfg(test)] and examples/.
- Very specific: line 16
Use ? everywhere. If you find yourself writing match res { Err(e) => return Err(e.into()), Ok(v) => v }, write res?
- Very specific: line 22
Use tokio::task::JoinSet for fan-out/fan-in instead of spawn + await loops.
- Very specific: line 37
Every pub symbol gets a doc-comment that compiles as a doctest where meaningful.
- Very specific: line 39
Prefer borrowed parameters (&str, &[u8], &Path).
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Rust patterns
Errors
- Library crates:
thiserror::Error-derived enum namedError, type aliaspub type Result<T> = std::result::Result<T, Error>;. Variants tagged with#[error("…")]. - Binary crates (
pf-clionly):anyhow::Resultis acceptable at the command-handler boundary. Internals still use typed errors. - Never
unwrap()/expect()outside#[cfg(test)]andexamples/. - Use
?everywhere. If you find yourself writingmatch res { Err(e) => return Err(e.into()), Ok(v) => v }, writeres?instead.
Async
tokiomulti-thread runtime;#[tokio::main]only in binaries.- Use
tokio::task::JoinSetfor fan-out/fan-in instead ofspawn+awaitloops. tokio::fsfor I/O paths in async contexts;std::fsonly in clearly- sync contexts.
Tracing
use tracing::{debug, info, warn, error, instrument};- Annotate every
pubasync function with#[instrument(skip(self))]or similar (skip large args). - Spans MUST carry meaningful field names:
tracing::info!(image=%cid, "snapshot complete"). Never log opaqueDebugstructs at info level.
API surface
- Every
pubsymbol gets a doc-comment that compiles as a doctest where meaningful.cargo test --docruns these in CI. - Prefer borrowed parameters (
&str,&[u8],&Path); acceptimpl AsRef<Path>only at the outermost API boundary. - Newtype the digest types — never expose raw
Stringfor content IDs.
Workspace lints
pedanticis on,module_name_repetitionsandmust_use_candidateare off. Fix every other clippy warning before committing.
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.

