agentleFS
MicrosoftKnown publishermicrosoft/wassette/.agents/skills/rust-code-style/SKILL.md

rust-code-style

Skill972 starsChanged 3 months agoMITView on GitHub

Write idiomatic, well-structured Rust for Wassette — single-responsibility design, anyhow error handling, Arc/Mutex for shared state, and the required formatting and linting with cargo +nightly fmt, cargo clippy, and cargo machete. Use when adding or refactoring Rust code in this repository.

5 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

7 rules. 0 are common, 3 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Keep it simple: prefer straightforward solutions over clever complexity.

    line 17
  2. Very specific:

    Error handling: use anyhow to add context and stack traces.

    line 20
  3. Distinctive:

    Traits and generics: use traits for shared behavior and generics for reusable, type-safe, extensible APIs.

    line 21
  4. Very specific:

    Thread safety: use stdlib primitives like Arc and Mutex for shared state.

    line 23
  5. Distinctive:

    Always run before committing:

    line 30
  6. Very specific:

    Write code that passes cargo clippy without warnings.

    line 38
  7. Very specific:

    Every .rs file must start with the Microsoft copyright header.

    line 42

“Common” is measured: kept by at least 6 in 10 of the 5 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-code-style skill

Apply Wassette's Rust conventions when writing or refactoring .rs files.

Best practices

  • Single responsibility: each function and struct has one clear purpose.
  • DRY: extract shared logic into reusable functions or modules.
  • Descriptive naming: name functions, variables, and types for readability.
  • Unit tests: cover every public function and its edge cases.
  • Keep it simple: prefer straightforward solutions over clever complexity.
  • Dependencies: manage them carefully in Cargo.toml; avoid unnecessary ones that bloat the project.
  • Error handling: use anyhow to add context and stack traces.
  • Traits and generics: use traits for shared behavior and generics for reusable, type-safe, extensible APIs.
  • Thread safety: use stdlib primitives like Arc and Mutex for shared state.
  • Performance: choose appropriate data types, e.g. &str over String when possible.

Formatting and linting

Always run before committing:

cargo +nightly fmt          # Format (nightly toolchain required)
cargo clippy --workspace    # Lint; resolve every warning
cargo machete               # Check for unused dependencies

Write code that passes cargo clippy without warnings.

Copyright headers

Every .rs file must start with the Microsoft copyright header. See the copyright-headers skill for the exact format and the automated script.

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.