agentleFS
gurinderugurinderu/craft/skills/rust-ecosystem/SKILL.md

rust-ecosystem

Skill1 starsChanged 40 days agoMITView on GitHub

Rust ecosystem and project setup — choosing crates, Cargo.toml and dependencies, features, workspaces, editions/MSRV, module layout, and publishing libraries. Use when adding a dependency, structuring a project or workspace, configuring Cargo, or preparing a crate to publish. Triggers: Cargo.toml, cargo add, feature flag, workspace, edition, MSRV, semver, which crate.

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 3

    Distinctive

    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
  1. Distinctive:

    Prefer the ecosystem's de-facto crates (serde, tokio, clap, …) over novelty — they're documented, supported, and what reviewers expect.

    line 33
  2. Very specific:

    Commit Cargo.lock for binaries (reproducible builds), not for libraries (let consumers resolve).

    line 47
  3. Distinctive:

    Use the latest edition for new projects (editions are opt-in and per-crate.

    line 58
  4. Very specific:

    Put real logic in a library crate and keep main.rs a thin shell — it makes the code testable and reusable (this is also the spirit of …

    line 72
  5. Distinctive:

    When/how to extract code into its own crate, or merge an over-split one → crate-extraction.md.

    line 98

“Common” is measured: kept by at least 6 in 10 of the 3 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Rust Ecosystem & Project Setup

Choosing dependencies, wiring up Cargo, and structuring a project — the decisions around the code rather than in it. Deep Cargo mechanics and library/publishing concerns are in the sub-files.

When to Use

  • Adding or evaluating a dependency
  • Structuring a project, workspace, or module tree
  • Configuring Cargo.toml, features, edition, MSRV
  • Preparing a library to publish (semver, docs, interop)

Choosing a crate

A dependency is a long-term liability — vet before adding:

CheckWhy
Maintenancerecent commits/releases; open-issue responsiveness; not abandoned
Adoptiondownloads / reverse-deps; widely-used crates are battle-tested
API surface & semverpost-1.0? churny pre-1.0 APIs cost you upgrades
Dependency weighthow many transitive deps + compile-time it drags in
Licensecompatible with yours (→ rust-security)
unsafe / soundnessaudited? unsafe-surface scan → rust-security

Prefer the ecosystem's de-facto crates (serde, tokio, clap, …) over novelty — they're documented, supported, and what reviewers expect. Don't pull a crate for a few lines you can write yourself; do pull one for anything security- or correctness-sensitive (crypto, parsing, time).

Cargo basics

cargo add serde --features derive    # edit Cargo.toml for you (cargo-edit, now built in)
cargo update                          # bump within semver ranges; updates Cargo.lock
cargo tree --locked                   # inspect the dependency graph (never rewrites Cargo.lock)
cargo tree -d --locked                # find duplicate versions

Commit Cargo.lock for binaries (reproducible builds), not for libraries (let consumers resolve). Dependency versions, features, and workspaces → cargo.md.

Project defaults

[package]
edition = "2024"        # latest edition; opt into new idioms
rust-version = "1.85"   # declare your MSRV so Cargo can enforce it
  • Use the latest edition for new projects (editions are opt-in and per-crate; they don't split the ecosystem).
  • Declare MSRV (rust-version) if anyone consumes your crate — and test it (cargo-hack, cargo-msrv).
  • Turn up clippy lints ([lints.clippy]) → rust-idioms.

Project layout

ShapeUse
single src/main.rsa small binary
src/lib.rs + src/main.rslogic in the lib (testable), thin binary on top — preferred for anything non-trivial
workspace ([workspace] members = [...])multiple related crates sharing a lockfile and target/

Put real logic in a library crate and keep main.rs a thin shell — it makes the code testable and reusable (this is also the spirit of rust-architecture). Module tree and mod/visibility mechanics → rust-idioms (visibility) and cargo.md (workspaces). When and how to pull a module out into its own crate (or merge an over-split one) → crate-extraction.md.

Supply-chain hygiene

cargo machete        # find unused dependencies
cargo tree -d --locked   # find duplicate/conflicting versions; no Cargo.lock (a library) → run it in a throwaway copy of the checkout

Trim what you don't use and de-duplicate the graph to keep the dependency liability in check. Vulnerability/advisory scanning and license/supply-chain policy (cargo-audit/cargo-deny) → rust-security (ties into rust-review's and rust-security's gates).

Boundaries

  • Publishing a library — semver discipline, public-API hygiene, doc conventions, interop → libraries.md (drawing on the Rust API Guidelines and Microsoft's Pragmatic Rust Guidelines).
  • Dependency vulnerabilities, license/supply-chain policy, and unsafe-surface scanning (cargo-audit/deny/geiger) → rust-security.
  • Build profiles for speed/size (LTO, codegen-units) → rust-performance.
  • Build scripts (build.rs), no_std, and cross-compilation → build-and-targets.md.
  • Naming and visibility idioms → rust-idioms.
  • When/how to extract code into its own crate, or merge an over-split one → crate-extraction.md.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.