Skip to content

Commit ff01b09

Browse files
Copilotronniegeraghtyheaths
authored
Add AGENTS.md file to align with AGENTS.md standards (Azure#3169)
- [x] Understand the issue and requirements - [x] Review existing .github/copilot-instructions.md - [x] Review CONTRIBUTING.md and README.md for context - [x] Create AGENTS.md file following agents.md canonical structure - [x] Include repository purpose and scope - [x] Document key workflows and commands - [x] Specify automation boundaries for agents - [x] Add guidance for safe CI/CD interactions - [x] Cross-link between .github/copilot-instructions.md and AGENTS.md - [x] Cross-link from CONTRIBUTING.md and README.md to AGENTS.md - [x] Validate the file format and content - [x] Address review feedback to improve accuracy and conciseness - [x] Clarify examples directory location and fix spelling - [x] Add rustfmt to cspell and enforce absolute links ## Summary Created a comprehensive AGENTS.md file at the root of the repository that: 1. **Defines repository purpose and scope**: Describes the Azure SDK for Rust, its status, primary language, and key technologies 2. **Documents repository structure**: Provides a clear overview of service directories vs. crate directories 3. **Specifies agent capabilities**: Lists recommended actions (code generation, code review, documentation, issue triage, refactoring) and restricted actions (no modifying generated code, breaking API compatibility, bypassing CI/CD checks, committing secrets, etc.) 4. **Describes key workflows**: Includes commands for building, testing (with provisioning), linting, formatting, code generation, and running examples 5. **Provides coding standards**: References .github/copilot-instructions.md for detailed Rust conventions, with correct guidance on azure_core::Result<T>, import consolidation, rustfmt, and absolute links 6. **Documents CI/CD integration**: Explains automated checks and references CONTRIBUTING.md for detailed Test Proxy usage 7. **Emphasizes safety and security**: Outlines code review, static analysis, secret scanning, and vulnerability reporting 8. **Cross-references documentation**: Links to relevant files like CONTRIBUTING.md, copilot-instructions.md, and Azure SDK design guidelines ### Latest Changes - **Added "rustfmt" to .vscode/cspell.json**: Ensures spell checking passes for this term - **Fixed relative link**: Updated .github/copilot-instructions.md to use absolute GitHub URL for AGENTS.md - **Added absolute link guidance**: AGENTS.md now includes repository requirement that all markdown links must be absolute URLs that work both online (from github.com) and offline (in IDE) <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>Add AGENTS.md file</issue_title> > <issue_description># 🧩 Add `AGENTS.md` file to align with [AGENTS.md](https://agents.md) standards > > ## 📄 Description > This repository currently includes a `.github/copilot-instructions.md` file, but it does not yet have an `AGENTS.md` file to describe how AI agents (e.g., Copilot, MCP, or LLM-based assistants) should interact with this repository. > > To align with emerging [AGENTS.md](https://agents.md) standards and ensure consistent developer experiences across Azure SDK repositories, we should add a top-level `AGENTS.md` file that defines: > > - Repository purpose and scope > - Key workflows, commands, and automation boundaries for agents > - Supported contribution actions (e.g., PR triage, labeling, issue summarization) > - Guidance for safe and effective agent interactions with CI/CD pipelines, SDK tests, and documentation > > ## ✅ Proposed Tasks > - [ ] Review existing `.github/copilot-instructions.md` and identify relevant guidance to merge or reference in `AGENTS.md`. > - [ ] Create an `AGENTS.md` file at the root of the repository following the canonical structure defined at [AGENTS.md](https://agents.md). > - [ ] Cross-link between `.github/copilot-instructions.md` and `AGENTS.md` for discoverability. > - [ ] (Optional) Add repository metadata in `AGENTS.md` to describe SDK-specific automation workflows (e.g., codegen, API review, test matrix). > > ## 📘 Example References > - [AGENTS.md — canonical spec](https://agents.md) > - [Example `.github/copilot-instructions.md`](https://github.com/Azure/azure-sdk-for-go/blob/main/.github/copilot-instructions.md) > > ## 🧭 Context > This issue is part of a broader initiative to introduce `AGENTS.md` across all Azure SDK repositories (see the [Azure SDK org overview](https://github.com/Azure/azure-sdk)) to standardize AI agent documentation and improve consistency in automation and Copilot-based contributions.</issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> Fixes Azure#3168 <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: ronniegeraghty <[email protected]> Co-authored-by: heaths <[email protected]>
1 parent ab3b181 commit ff01b09

File tree

5 files changed

+263
-0
lines changed

5 files changed

+263
-0
lines changed

.github/copilot-instructions.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ You are an expert Rust programmer. You write safe, efficient, maintainable, and
66
- Do not be overly apologetic and focus on clear guidance.
77
- If you cannot confidently generate code or other content, do not generate anything and ask for clarification.
88

9+
> **Note**: For comprehensive guidance on how AI agents should interact with this repository, including workflows, automation boundaries, and repository structure, see [AGENTS.md](https://github.com/Azure/azure-sdk-for-rust/blob/main/AGENTS.md).
10+
911
## Prerequisites
1012

1113
- To use Azure SDK MCP tool calls, the user must have PowerShell installed. Provide [PowerShell installation instructions](https://learn.microsoft.com/powershell/scripting/install/installing-powershell) if not installed, and recommend restarting the IDE to start the MCP server.

.vscode/cspell.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"bugbug",
3535
"checkpointstore",
3636
"clippy",
37+
"codeowners",
3738
"contoso",
3839
"cplusplus",
3940
"cpptools",
@@ -71,6 +72,7 @@
7172
"pwsh",
7273
"reqwest",
7374
"rsplit",
75+
"rustfmt",
7476
"runtimes",
7577
"rustup",
7678
"schannel",

AGENTS.md

Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
# AGENTS.md
2+
3+
This document provides guidance for AI agents (e.g., GitHub Copilot, MCP servers, or LLM-based assistants) interacting with the Azure SDK for Rust repository.
4+
5+
## Repository Overview
6+
7+
### Purpose
8+
9+
The Azure SDK for Rust provides Rust language bindings and client libraries for Azure services, following the [Azure SDK Design Guidelines for Rust](https://azure.github.io/azure-sdk/rust_introduction.html).
10+
11+
### Status
12+
13+
⚠️ Under active development. Large breaking changes may occur before 1.0 release.
14+
15+
### Primary Language
16+
17+
Rust (MSRV: 1.85)
18+
19+
### Key Technologies
20+
21+
- Rust toolchain with Cargo
22+
- TypeSpec for API specification and code generation
23+
- OpenTelemetry for distributed tracing
24+
- Test Proxy for recorded integration tests
25+
26+
## Repository Structure
27+
28+
```
29+
.
30+
├── sdk/ # Service-specific crates organized by service
31+
│ └── <service>/ # Service directory (e.g., "keyvault", "storage")
32+
│ ├── <crate>/ # Service crate (e.g., "azure_security_keyvault_secrets")
33+
│ ├── assets.json # Pointer to test recordings (may be under <crate>/)
34+
│ ├── test-resources.bicep # Test resource definitions (may be under <crate>/)
35+
│ └── tsp-location.yaml # Pointer to TypeSpec in azure-rest-api-specs (may be under <crate>/)
36+
├── eng/ # Engineering system scripts and common tooling
37+
├── doc/ # Additional documentation
38+
├── .github/
39+
│ ├── copilot-instructions.md # Copilot-specific Rust coding guidelines
40+
│ ├── instructions/ # Agent instruction files for specific tasks
41+
│ └── prompts/ # Reusable Copilot prompts
42+
├── CONTRIBUTING.md # Contribution guidelines (see for detailed workflows)
43+
└── README.md # Repository overview
44+
```
45+
46+
## Agent Capabilities
47+
48+
### Recommended Actions
49+
50+
AI agents can assist with:
51+
52+
1. **Code Generation**
53+
- Writing new Rust code following repository conventions (see `.github/copilot-instructions.md`)
54+
- Generating unit tests using `#[cfg(test)]` modules
55+
- Creating integration tests with `#[recorded::test]` attributes (see `CONTRIBUTING.md` for details)
56+
- Generating documentation tests in `.rs` files (avoid `no_run` when tests can be run)
57+
- In README markdown files, use ` ```rust no_run` for examples with placeholders
58+
- Running `rustfmt` on all generated code to ensure proper formatting
59+
60+
2. **Code Review Support**
61+
- Identifying potential bugs or safety issues
62+
- Suggesting improvements for idiomatic Rust patterns
63+
- Checking adherence to Azure SDK design guidelines
64+
- Reviewing error handling using `azure_core::Result<T>`
65+
66+
3. **Documentation**
67+
- Improving inline documentation (using `///` doc comments)
68+
- Updating README files
69+
- Creating or updating CHANGELOG entries (see `.github/instructions/changelog.instructions.md`)
70+
- Writing hero scenario examples in doc comments (avoid examples in `examples/` directories unless demonstrating primary use cases)
71+
72+
4. **Issue Triage**
73+
- Labeling issues with appropriate tags
74+
- Identifying duplicate issues
75+
- Suggesting relevant code owners based on `CODEOWNERS`
76+
- Summarizing issue discussions
77+
78+
5. **Refactoring**
79+
- Applying clippy suggestions
80+
- Improving code organization and modularity
81+
- Updating dependencies in `Cargo.toml`
82+
- Consolidating imports (e.g., `use std::{borrow::Cow, marker::PhantomData};` instead of separate lines)
83+
84+
### Restricted Actions
85+
86+
AI agents **should not**:
87+
88+
1. **Modify Generated Code**
89+
- Never edit files in `generated/` subdirectories
90+
- These are produced by TypeSpec code generators and will be overwritten
91+
- Instead, propose changes to TypeSpec specifications in [Azure/azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs)
92+
93+
2. **Break API Compatibility**
94+
- Avoid introducing breaking changes without explicit approval
95+
- Check if changes affect public APIs before proceeding
96+
- Consider deprecation process (see `doc/deprecation-process.md`)
97+
98+
3. **Bypass CI/CD Checks**
99+
- Do not suggest skipping or disabling CI checks
100+
- All code must pass `cargo build`, `cargo test`, and `cargo clippy`
101+
102+
4. **Commit Secrets**
103+
- Never include credentials, keys, or tokens in code
104+
- Use environment variables for sensitive data
105+
- Sanitize test recordings to remove secrets
106+
107+
5. **Modify Security or License Files**
108+
- Do not alter `SECURITY.md`, `LICENSE.txt`, or `CODE_OF_CONDUCT.md` without maintainer approval
109+
110+
## Key Workflows
111+
112+
### Building
113+
114+
```bash
115+
# Build a specific crate
116+
cargo build -p <crate-name>
117+
118+
# Build entire workspace (not recommended unless necessary)
119+
cargo build --workspace
120+
```
121+
122+
### Testing
123+
124+
```bash
125+
# Run tests for a specific crate
126+
cargo test -p <crate-name>
127+
128+
# Run integration tests with recordings
129+
cargo test -p <crate-name> --test <test-name>
130+
131+
# Provision test resources (see CONTRIBUTING.md for details)
132+
eng/common/TestResources/New-TestResources.ps1 -ServiceDirectory <service>
133+
134+
# Record new test sessions (requires provisioned resources)
135+
AZURE_TEST_MODE=record cargo test -p <crate-name> --test <test-name>
136+
```
137+
138+
See `CONTRIBUTING.md` for comprehensive testing guidance including debugging, Test Proxy usage, and trace logging.
139+
140+
### Linting and Formatting
141+
142+
```bash
143+
# Check for common issues
144+
cargo clippy -p <crate-name>
145+
146+
# Auto-fix some issues
147+
cargo clippy --fix -p <crate-name>
148+
149+
# Format code
150+
cargo fmt -p <crate-name>
151+
```
152+
153+
### Code Generation
154+
155+
For crates with TypeSpec specifications:
156+
157+
```bash
158+
cd sdk/<service>/<crate-name>
159+
tsp-client update
160+
```
161+
162+
### Running Examples
163+
164+
```bash
165+
cargo run --package <crate-name> --example <example-name>
166+
```
167+
168+
## Coding Standards
169+
170+
Agents should follow guidelines in `.github/copilot-instructions.md` and `CONTRIBUTING.md`, including:
171+
172+
- **Naming Conventions**:
173+
- Types/variants: `PascalCase`
174+
- Functions/fields/parameters: `snake_case`
175+
- Constants: `UPPER_SNAKE_CASE`
176+
- Crates/modules: `snake_case`
177+
178+
- **Import Style**:
179+
- Explicit imports (no `use foo::*`)
180+
- Consolidate related imports (e.g., `use std::{borrow::Cow, marker::PhantomData};`)
181+
- Prefer `crate::` for internal references
182+
183+
- **Error Handling**:
184+
- Service crate code should return `azure_core::Result<T>` (where `E` defaults to `azure_core::Error`)
185+
- Use the `?` operator for error propagation
186+
- Examples should use `Result<(), Box<dyn std::error::Error>>`
187+
188+
- **Documentation**:
189+
- All public APIs need `///` doc comments
190+
- Include runnable doc test examples where appropriate
191+
- Hero scenario examples under the `examples/` directory should have `#[tokio::main]` async main functions
192+
- Use absolute links in markdown files (e.g., `https://github.com/Azure/azure-sdk-for-rust/blob/main/AGENTS.md`) instead of relative links (e.g., `../AGENTS.md`)
193+
- Links must work both online (from github.com) and offline (when viewed in an IDE)
194+
195+
- **Testing**:
196+
- Place unit tests in `#[cfg(test)] mod tests`
197+
- Use `#[recorded::test]` for integration tests (see `CONTRIBUTING.md`)
198+
- Test names should be descriptive, not prefixed with "test"
199+
200+
## CI/CD Integration
201+
202+
All pull requests trigger:
203+
- `cargo build` - Compilation check
204+
- `cargo test` - Unit and integration tests
205+
- `cargo clippy` - Lint checks
206+
- `cargo fmt --check` - Format validation
207+
- License/CLA verification
208+
- Code coverage analysis
209+
210+
Integration tests use the Azure SDK Test Proxy for recording/playback. See `CONTRIBUTING.md` for Test Proxy setup and usage.
211+
212+
## Safety and Security
213+
214+
1. **Code Review**: All changes require review and approval from code owners
215+
2. **Static Analysis**: Must pass `cargo clippy` without warnings
216+
3. **Secret Scanning**: Automated checks prevent committing credentials
217+
4. **Dependencies**: Managed through workspace `Cargo.toml`, vetted for security
218+
5. **Vulnerability Reporting**: Via MSRC at <[email protected]>
219+
220+
## Cross-References
221+
222+
For detailed guidance, see:
223+
224+
- **Rust Coding Guidelines**: `.github/copilot-instructions.md`
225+
- **Contribution Workflows**: `CONTRIBUTING.md`
226+
- **Changelog Guidelines**: `.github/instructions/changelog.instructions.md`
227+
- **Git Commit Standards**: `doc/git-commit-instructions.md`
228+
- **Deprecation Process**: `doc/deprecation-process.md`
229+
- **Azure SDK Design Guidelines**: https://azure.github.io/azure-sdk/rust_introduction.html
230+
231+
## Agent-Specific Instructions
232+
233+
Additional specialized instructions for specific workflows can be found in:
234+
- `.github/instructions/` - Task-specific agent instructions
235+
- `.github/prompts/` - Reusable Copilot prompts (use `#prompt` in Copilot)
236+
237+
## Getting Help
238+
239+
- **Issues**: https://github.com/Azure/azure-sdk-for-rust/issues
240+
- **Discussions**: Use issue comments or StackOverflow with `azure` + `rust` tags
241+
- **Code Owners**: See `.github/CODEOWNERS` for service-specific contacts
242+
243+
## Telemetry and Privacy
244+
245+
The SDK includes telemetry via `User-Agent` headers. Follow Microsoft Privacy Statement: https://go.microsoft.com/fwlink/?LinkID=824704
246+
247+
## License
248+
249+
All contributions are licensed under the MIT License. See `LICENSE.txt`.
250+
251+
---
252+
253+
**Last Updated**: 2025-01-20
254+
**Version**: 1.0
255+
**Canonical Spec**: https://agents.md

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ To generate a new performance test, for example, you might prompt with:
2929
Using #perf-test.prompt.md generate a perf test for SecretClient::get_secret.
3030
```
3131

32+
For comprehensive guidance on how AI agents should interact with this repository, including workflows, automation boundaries, and safety guidelines, see [AGENTS.md](https://github.com/Azure/azure-sdk-for-rust/blob/main/AGENTS.md).
33+
3234
## Generated code
3335

3436
If you want to contribute to a file that is generated (the file is located in a `generated` subdirectory), the best approach is to open a PR on the TypeSpec specification since we cannot replace generated code that will be replaced when regenerated.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ We would love to incorporate the community's input into our library design proce
102102

103103
For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-rust/blob/main/CONTRIBUTING.md).
104104

105+
For guidance on how AI agents should interact with this repository, see [AGENTS.md](https://github.com/Azure/azure-sdk-for-rust/blob/main/AGENTS.md).
106+
105107
This project welcomes contributions and suggestions. Most contributions require you to agree to a
106108
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
107109
the rights to use your contribution. For details, visit <https://cla.opensource.microsoft.com>.

0 commit comments

Comments
 (0)