agentleFS
zajcazajca/pohunek/.agents/rust-guidelines/SKILL.md

ms-rust

Skill8 starsChanged 9 days agoMITView on GitHub

ALWAYS invoke this skill BEFORE writing or modifying ANY Rust code (.rs files) even for simple Hello World programs. Enforces Microsoft-style Rust development discipline and requires consulting the appropriate guideline files before any coding activity. This skill is MANDATORY for all Rust development.

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. About 0 are common, 12 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈12

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

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

    Before writing or modifying Rust code, the agent must load ONLY the guideline files that apply to the requested task, using segmented …

    line 21
  2. Distinctive:

    Use when the Rust code involves AI agents, LLM-driven code generation, making APIs easier for AI systems, comprehensive documentation, or …

    line 27
  3. Distinctive:

    Use when working on application-level error handling with anyhow or eyre, CLI tools, desktop applications, performance optimization using …

    line 31
  4. Distinctive:

    Use when writing public API documentation and doc comments, creating canonical documentation sections (Examples, Errors, Panics, Safety), …

    line 39
  5. Distinctive:

    Use when loading multiple Rust-based dynamic libraries, creating FFI boundaries, sharing data between different Rust compilation artifacts, …

    line 43
  6. Distinctive:

    Use when creating or modifying Rust libraries, structuring a crate, designing public APIs, or making dependency decisions.

    line 47
  7. Distinctive:

    Use when profiling hot paths, optimizing for throughput and CPU efficiency, managing allocation patterns and memory usage, or implementing …

    line 55
  8. Distinctive:

    Use when writing unsafe code for novel abstractions, performance, or FFI, ensuring soundness, preventing undefined behavior, documenting …

    line 63
  9. Distinctive:

    Use in ALL Rust tasks. Defines general best practices, style, naming, organizational conventions, and foundational principles.

    line 67
  10. Distinctive:

    Use when creating reusable library crates, managing Cargo features, building native -sys crates for C interop, or ensuring libraries work …

    line 71
  11. Distinctive:

    Use when exposing public APIs, managing external dependencies, designing types for Send/Sync compatibility, avoiding leaking third-party …

    line 75
  12. Distinctive:

    Use when avoiding statics and thread-local state, making I/O mockable, preventing glob re-exports, or feature-gating test utilities.

    line 79
  13. Distinctive:

    Use when designing user-friendly library APIs, managing error types, creating runtime abstractions and trait-based designs, or structuring …

    line 83

≈ “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.

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

Current compliance date: 2026-06-26

Rust Development Skill

<!-- The Pragmatic Rust Guidelines are copyrighted (c) by Microsoft Corporation and licensed under the MIT license. -->

This skill enforces structured, guideline-driven Rust development. It ensures all Rust code strictly follows the appropriate Microsoft-style rules, documentation formats, and quality constraints.

Mandatory Workflow

This skill MUST be invoked for ANY Rust action, including:

  • Creating new .rs files (even minimal examples like Hello World)
  • Modifying existing .rs files (any change, no matter how small)
  • Reviewing, refactoring, or rewriting Rust code

Which guideline to read and when

Before writing or modifying Rust code, the agent must load ONLY the guideline files that apply to the requested task, using segmented reading (offset and limit) when needed.

Guidelines and when they apply

1. 01_ai_guidelines.md

Use when the Rust code involves AI agents, LLM-driven code generation, making APIs easier for AI systems, comprehensive documentation, or strong type systems that help AI avoid mistakes.

2. 02_application_guidelines.md

Use when working on application-level error handling with anyhow or eyre, CLI tools, desktop applications, performance optimization using mimalloc allocator, or user-facing features.

3. 03_correctness_guidelines.md

Consult this guideline when relevant to your task.

4. 04_documentation.md

Use when writing public API documentation and doc comments, creating canonical documentation sections (Examples, Errors, Panics, Safety), structuring module-level documentation, or using #[doc(inline)] annotations.

5. 05_ffi_guidelines.md

Use when loading multiple Rust-based dynamic libraries, creating FFI boundaries, sharing data between different Rust compilation artifacts, or dealing with portable vs non-portable data types across DLL boundaries.

6. 06_library_guidelines.md

Use when creating or modifying Rust libraries, structuring a crate, designing public APIs, or making dependency decisions.

7. 07_macros_guidelines.md

Consult this guideline when relevant to your task.

8. 08_performance_guidelines.md

Use when profiling hot paths, optimizing for throughput and CPU efficiency, managing allocation patterns and memory usage, or implementing yield points in long-running async tasks.

9. 09_project_guidelines.md

Consult this guideline when relevant to your task.

10. 10_safety.md

Use when writing unsafe code for novel abstractions, performance, or FFI, ensuring soundness, preventing undefined behavior, documenting safety requirements, or reviewing unsafe blocks with Miri.

11. 11_universal_guidelines.md

Use in ALL Rust tasks. Defines general best practices, style, naming, organizational conventions, and foundational principles.

12. 12_libraries_building_guidelines.md

Use when creating reusable library crates, managing Cargo features, building native -sys crates for C interop, or ensuring libraries work out-of-the-box on all platforms.

13. 13_libraries_interoperability_guidelines.md

Use when exposing public APIs, managing external dependencies, designing types for Send/Sync compatibility, avoiding leaking third-party types, or creating escape hatches for native handle interop.

14. 14_libraries_resilience_guidelines.md

Use when avoiding statics and thread-local state, making I/O mockable, preventing glob re-exports, or feature-gating test utilities.

15. 15_libraries_ux_guidelines.md

Use when designing user-friendly library APIs, managing error types, creating runtime abstractions and trait-based designs, or structuring crate organization.

Coding Rules

  1. Load the necessary guideline files BEFORE ANY RUST CODE GENERATION.
  2. Apply the required rules from the relevant guidelines.
  3. Apply the M-CANONICAL-DOCS documentation format (summary sentence < 15 words, then extended docs, Examples, Errors, Panics, Safety, Abort sections as applicable).
  4. Comments must ALWAYS be written in American English, unless the user explicitly requests a different language.
  5. If the file is fully compliant, add the comment // Rust guideline compliant 2026-06-26 at the top of the file, immediately before the first use or item. Place it below any license/copyright header and any module-level //! doc comment, separated from the preamble and the code by a blank line. When the file has no preamble, the comment is line 1.

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.