lang-rust
Skill0 starsChanged 7 days agoMITView on GitHub
Use when writing, reviewing, testing or setting up Rust backend code in a loops run (the rust language pack) - toolchain, layout, race policy, coverage, idioms and footguns.
- Installs packages
1 other project uses a version of this.
Adopted by
Most recently taken up by
- alexderz/agentic-toolboxtheir own version, first seen Oct 17, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- alexderz/agentic-toolbox★ 5same 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 repository35 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- skills/work/platforms/claude.mdCLAUDE.md
- llms.txtllms.txt
- clarifySkill
- consistencySkill
- debuggingSkill
- documentationSkill
- featureSkill
- hexagonalSkill
- initSkill
- jobs-and-state-machinesSkill
- lang-clojureSkill
- lang-cppSkill
- lang-csharpSkill
- lang-elixirSkill
- lang-erlangSkill
- lang-goSkill
- lang-javaSkill
- lang-kotlinSkill
- lang-phpSkill
- lang-pythonSkill
- lang-rubySkill
- lang-scalaSkill
- lang-swiftSkill
- lang-typescriptSkill
- memorySkill
- parallel-workSkill
- performanceSkill
- qualitySkill
- reportSkill
- review-integrationSkill
- statusSkill
- testingSkill
- workSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 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.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 39
never hold a std::sync::Mutex guard or a RefCell borrow across .await.
- Very specific: line 40
never silence a lint with a blanket #![allow] to get green.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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
lang-rust
The Rust language pack: specs/languages/rust/pack.json (what the gate runs) and specs/languages/rust/RULES.md (the rule book, IDs RUST-<SEC>-NN). Universal rules are not repeated here: layering is specs/ARCHITECTURE.md, SOLID is specs/SOLID.md, gates and the race rule are WORKFLOW §6, test and repo practices are specs/TESTING.md and specs/REPO_PRACTICES.md.
When it applies
loops lang detect reports rust (a Cargo.toml at the root). Check with loops lang show rust for the resolved pack (the nextest variant is picked when .config/nextest.toml exists).
Project rules first
Follow the project's own config over this pack: rust-toolchain.toml, rustfmt.toml, clippy.toml, [workspace.lints], deny.toml, .cargo/config.toml, .config/nextest.toml, and the framework already in use (axum, actix-web, tonic). Read them before coding (config_files in the pack). Every time you follow a project rule over a pack rule, run loops run override --rule "<pack rule>" --project "<project rule, file:line>" --note "<what you did>".
Toolchain the gate runs
Agents run loops gate (or loops gate --only <checks> --pkgs -p,<crate> while iterating); the checks, in order:
| Check | Command | Required |
| deps | cargo fetch --locked | no |
| build | cargo build {pkgs} --all-targets --locked | yes |
| fmt | cargo fmt --all --check | no (treat as required when rustfmt.toml is committed) |
| clippy | cargo clippy {pkgs} --all-targets --all-features --locked -- -D warnings -D unsafe_code -D clippy::await_holding_lock -D clippy::await_holding_refcell_ref | yes (also the race substitute) |
| arch | loops arch | no |
| test | cargo llvm-cov {pkgs} --locked --lcov --output-path {coverage} (nextest variant: cargo llvm-cov nextest ...) | yes |
| doctest | cargo test --doc {pkgs} --locked | yes |
| coverage | new-code coverage from the lcov file, at least 70% | yes |
| miri, loom, tsan, doc, deny, audit | see pack | off by default |
{pkgs} is --workspace by default. --pkgs -p,<crate> replaces it for a scoped run (comma-separated, so -p and the crate name become two arguments).
The pack sets CARGO_INCREMENTAL=0. CARGO_TARGET_DIR and TMPDIR are scoped per run by loops; CARGO_HOME, RUSTUP_HOME and SCCACHE_DIR are shared (RUST-OPS-05). Never set CARGO_TARGET_DIR yourself. A cold per-run target dir recompiles everything: RUSTC_WRAPPER=sccache helps when installed. Cap parallelism with CARGO_BUILD_JOBS=2 and cargo nextest -j2. After each edit the post-edit hook runs rustfmt --edition {edition} <file> on that one file only; never run cargo fmt (it rewrites files other agents own, see specs/PARALLEL_WORK.md).
Required tools: the rustup components rustfmt, clippy, llvm-tools-preview and cargo-llvm-cov. A missing coverage tool fails the gate; the install hint is in the check note (rustup component add llvm-tools-preview && cargo install cargo-llvm-cov --locked). The official rust:1 Docker image has neither rustfmt nor clippy: add them through rust-toolchain.toml (components = ["rustfmt","clippy","llvm-tools-preview"]).
Race policy
Safe Rust is data-race free by construction, so the pack uses race.mode = none with a required substitute (WORKFLOW §6, RUST-CONC-04): the clippy check denies unsafe_code, await_holding_lock and await_holding_refcell_ref. To satisfy it:
- keep
unsafeout; a crate that really needs it adds#[allow(unsafe_code)]on the smallest module, a// SAFETY:comment on every block, and the optional checksmiri(UB and data races, nightly),loom(lock-free models,--cfg loom) and, for FFI,tsan(nightly,-Zbuild-std). They are off by default: enable them in the project config or withloops gate --only miri; - never hold a
std::sync::Mutexguard or aRefCellborrow across.await; share byArcand channels, not by cloning locks (RUST-CONC-02, -08); - never silence a lint with a blanket
#![allow]to get green; fix the code or record an override. Details in concurrency.md.
Coverage recipe
cargo llvm-cov writes lcov to {coverage}; loops creates the parent directory. tests/, benches/, examples/, build.rs, src/main.rs, src/bin/ and generated code are not judged. Inline #[cfg(test)] lines count as code (an accepted bias, D8). Doctests are run separately and not measured.
Prerequisites the architect or rust-engineer adds in wave 0 (an override when the project lacks them):
rust-toolchain.tomlwith the components above;[workspace.lints]plus[lints] workspace = truein every crate (RUST-TOOL-04);Cargo.lockcommitted (RUST-REPO-06) and.gitignorewith/target,lcov.info,*.profraw;.config/nextest.tomlonly if the project wants nextest (it switches the variant);.sqlx/committed when sqlx macros are used (RUST-DATA-02).
Layers on Rust
crates/
domain/ lib std + plain value types only (no tokio, sqlx, axum, reqwest, tracing)
application/ lib ports (traits) + use cases; depends on domain
adapter-http/ lib axum handlers: inbound adapter, DTOs, error mapping
adapter-postgres/ lib sqlx repositories: outbound adapter, implements ports
bootstrap/ bin composition root: config, wiring, shutdown (thin main.rs)Single-crate service: modules domain, application, adapters with pub(crate) visibility, thin main.rs over a library. The crate graph in Cargo.toml is the first line of defence; loops arch regex-scans use lines for the rest. See architecture.md.
Top 10 footguns
- Blocking the async runtime (
std::fs,thread::sleep, CPU loops): usetokio::fs,spawn_blocking. std::sync::Mutexguard orRefCellborrow held across.await: scope it before awaiting.unwrap/expect/v[i]on external input:?,.get(i).select!or timeouts over cancellation-unsafe futures: use cancel-safe methods, make writes transactional.- Detached
tokio::spawnthat swallows panics: keep theJoinHandle/JoinSet, logJoinError. - Release-mode integer overflow and
ascasts:checked_*,try_from,overflow-checks = true. .clone()to please the borrow checker,unbounded_channel: borrow,Arc, bounded channels.- Byte-slicing UTF-8 (
&s[..10]):s.get(..10),char_indices. - A
reqwest::Clientper request, no timeouts: one shared client withtimeout. - Unlocked dependency graph, unvetted
build.rs: commitCargo.lock,--locked,cargo deny check.
Load on demand
- repo.md: workspace layout, lockfile, toolchain pin, MSRV, editions, CI shape, releases.
- architecture.md: crates as layers, ports as traits, the domain purity list,
loops archlimits. - idioms.md: errors,
unwrappolicy, ownership, enums, naming, overflow, time, strings. - testing.md: test layout, nextest, doubles, integration tests, coverage, flakiness.
- concurrency.md: tokio rules, cancellation, shutdown, the race substitute and the optional tiers.
- security.md: injection, secrets, crypto, SSRF, supply chain (cargo-deny, cargo-audit), panics as DoS.
- data-api.md: sqlx/diesel, migrations, transactions, axum/tower, resilience, tracing, config, Docker.
- frameworks.md: axum and actix-web conventions and framework footguns.
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.

