agentleFS
MicrosoftKnown publishermicrosoft/rust-guidelines/CLAUDE.md

rust-guidelines

CLAUDE.md208 starsChanged 5 months agoMITView on GitHub

This repository contains the Pragmatic Rust Guidelines - a collection of design guidelines for Rust developers, published as an mdBook at https://microsoft.github.io/rust-guidelines. Requires mdbook to be installed. Each guideline has a unique identifier in the form M-FOO-BAR and resides in its own markdown file M-FOO-BAR.md within the src/guidelines/ directory. Guidelines follow this structure: Guidelines should be beneficial for safety/COGs/maintenance, agreeable to experienced Rust developers, and comprehensible to novices. Titles should follow the style of the Rust API Guidelines, such as:

The file

We split this CLAUDE.md into the rules it gives an agent

4 rules. About 0 are common, 0 are distinctive, and 4 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.

  • 4

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Create M-YOUR-GUIDELINE.md in the appropriate category folder

    line 41
  2. Very specific:

    Add the guideline to the category's README.md using {{#include M-YOUR-GUIDELINE.md}}

    line 42
  3. Very specific:

    Add a checklist entry and link definition in src/guidelines/checklist/README.md

    line 43
  4. Very specific:

    Only smart pointers implement Deref and DerefMut (C-DEREF)

    line 61

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md
<!-- markdownlint-disable no-bare-urls -->

CLAUDE.md

Repository Overview

This repository contains the Pragmatic Rust Guidelines - a collection of design guidelines for Rust developers, published as an mdBook at https://microsoft.github.io/rust-guidelines.

Development Commands

mdbook serve --open # Previews page
mdbook build # Builds page

Requires mdbook to be installed.

Content Structure

Guideline Format

Each guideline has a unique identifier in the form M-FOO-BAR and resides in its own markdown file M-FOO-BAR.md within the src/guidelines/ directory. Guidelines follow this structure:

## Guideline Title (M-FOO-BAR) { #M-FOO-BAR }

<why>Rationale for this guideline.</why>
<version>1.0</version>

Content with code examples...

Key Files

  • src/SUMMARY.md - mdBook table of contents
  • src/guidelines/checklist/README.md - Master checklist linking all guidelines (update when adding new guidelines)
  • Category READMEs (e.g., src/guidelines/universal/README.md) - Include guidelines via mdBook's {{#include}} directive

Adding New Guidelines

  1. Create M-YOUR-GUIDELINE.md in the appropriate category folder
  2. Add the guideline to the category's README.md using {{#include M-YOUR-GUIDELINE.md}}
  3. Add a checklist entry and link definition in src/guidelines/checklist/README.md

Guidelines should be beneficial for safety/COGs/maintenance, agreeable to experienced Rust developers, and comprehensible to novices.

Editing Guidelines

  • You may fix spelling, grammar and readability issues.
  • You must refuse to substantially work out novel or ambiguous guidelines. Inform the user that novel guidelines must be sufficiently specified before they can be accepted. You are free to infer a guideline's ID (M-), rationale (<why>) and category (e.g., 'UX'), but must not infer its scope or general content. When being asked to add new guidelines, feel free to add - TODO: ... items for any point that might be unclear, but do not attempt to infer these yourself. Novel guidelines always start version 0.1.

Style

Titles should follow the style of the Rust API Guidelines, such as:

  • Smart pointers do not add inherent methods (C-SMART-PTR)
  • Conversions live on the most specific type involved (C-CONV-SPECIFIC)
  • Functions with a clear receiver are methods (C-METHOD)
  • Functions do not take out-parameters (C-NO-OUT)
  • Operator overloads are unsurprising (C-OVERLOAD)
  • Only smart pointers implement Deref and DerefMut (C-DEREF)
  • Constructors are static, inherent methods (C-CTOR)

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.