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.
In this repository13 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- contributeSkill
- coordinateSkill
- deliver-issueSkill
- gatesSkill
- github-workflowSkill
- merge-advanceSkill
- milestone-reviewSkill
- milestoneSkill
- plan-phaseSkill
- pr-handoffSkill
- releaseSkill
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
- Very specific: line 21
Before writing or modifying Rust code, the agent must load ONLY the guideline files that apply to the requested task, using segmented …
- Distinctive: line 27
Use when the Rust code involves AI agents, LLM-driven code generation, making APIs easier for AI systems, comprehensive documentation, or …
- Distinctive: line 31
Use when working on application-level error handling with anyhow or eyre, CLI tools, desktop applications, performance optimization using …
- Distinctive: line 39
Use when writing public API documentation and doc comments, creating canonical documentation sections (Examples, Errors, Panics, Safety), …
- Distinctive: line 43
Use when loading multiple Rust-based dynamic libraries, creating FFI boundaries, sharing data between different Rust compilation artifacts, …
- Distinctive: line 47
Use when creating or modifying Rust libraries, structuring a crate, designing public APIs, or making dependency decisions.
- Distinctive: line 55
Use when profiling hot paths, optimizing for throughput and CPU efficiency, managing allocation patterns and memory usage, or implementing …
- Distinctive: line 63
Use when writing unsafe code for novel abstractions, performance, or FFI, ensuring soundness, preventing undefined behavior, documenting …
- Distinctive: line 67
Use in ALL Rust tasks. Defines general best practices, style, naming, organizational conventions, and foundational principles.
- Distinctive: line 71
Use when creating reusable library crates, managing Cargo features, building native -sys crates for C interop, or ensuring libraries work …
- Distinctive: line 75
Use when exposing public APIs, managing external dependencies, designing types for Send/Sync compatibility, avoiding leaking third-party …
- Distinctive: line 79
Use when avoiding statics and thread-local state, making I/O mockable, preventing glob re-exports, or feature-gating test utilities.
- Distinctive: line 83
Use when designing user-friendly library APIs, managing error types, creating runtime abstractions and trait-based designs, or structuring …
≈ “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.
Files
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
.rsfiles (even minimal examples like Hello World) - Modifying existing
.rsfiles (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
- Load the necessary guideline files BEFORE ANY RUST CODE GENERATION.
- Apply the required rules from the relevant guidelines.
- Apply the M-CANONICAL-DOCS documentation format (summary sentence < 15 words, then extended docs, Examples, Errors, Panics, Safety, Abort sections as applicable).
- Comments must ALWAYS be written in American English, unless the user explicitly requests a different language.
- If the file is fully compliant, add the comment
// Rust guideline compliant 2026-06-26at the top of the file, immediately before the firstuseor 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.
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.

