agentleFS
MicrosoftKnown publishermicrosoft/agent-framework/dotnet/AGENTS.md

agent-framework / dotnet

AGENTS.md14k starsChanged 10 months agoMITView on GitHub

Instructions for AI coding agents working in the .NET codebase. See ./.github/skills/build-and-test/SKILL.md for detailed instructions on building, testing, and linting projects. See ./.github/skills/project-structure/SKILL.md for an overview of the project structure. See ./.github/skills/pull-requests/SKILL.md for guidance on writing PR descriptions and handling/resolving PR review comments. The framework integrates with Microsoft.Extensions.AI and Microsoft.Extensions.AI.Abstractions (external NuGet packages) using types like IChatClient, FunctionInvokingChatClient, AITool, AIFunction, ChatMessage, and AIContent. When developing or reviewing code, verify adherence to these key design principles: Samples (in ./samples/ folder) should…

Trending

More talk lately.about the whole repository

Dec 2025: 1 mentionJan 2026: 0 mentionsFeb 2026: 1 mentionMar 2026: 3 mentionsApr 2026: 5 mentionsMay 2026: 3 mentionsJun 2026: 1 mentionJul 2026: 1 mentionAug 2026: 1 mentionSep 2026: 3 mentionsOct 2026: 1 mentionNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the microsoft/agent-framework repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about microsoft/agent-framework

The biggest 5 of 31 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 31

Talked about on GitHub, Bluesky and Hacker News (31 times).

On GitHub · 17

12 more on GitHub

On Bluesky · 10

5 more on Bluesky

The file

Show its rules and text

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

13 rules. About 0 are common, 6 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

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

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

    Command output capture: When running dotnet build, dotnet test, dotnet format, or similar commands, redirect output to a temp file first …

    line 36
  2. Very specific:

    Encoding: All new files must be saved with UTF-8 encoding with BOM (Byte Order Mark).

    line 37
  3. Very specific:

    Async: Use Async suffix for methods returning Task/ValueTask

    line 40
  4. Very specific:

    Private classes: Should be sealed unless subclassed

    line 41
  5. Very specific:

    Config: Read from environment variables with UPPER_SNAKE_CASE naming

    line 42
  6. Very specific:

    Tests: Add Arrange/Act/Assert comments.

    line 43
  7. Distinctive:

    When developing or reviewing code, verify adherence to these key design principles:

    line 47
  8. Distinctive:

    DRY: Avoid code duplication by moving common logic into helper methods or helper classes.

    line 49
  9. Distinctive:

    Encapsulation: Keep implementation details private and expose only necessary public APIs.

    line 51
  10. Distinctive:

    Strong Typing: Use strong typing to ensure that code is self-documenting and to catch errors at compile time.

    line 52
  11. Distinctive:

    When adding a new sample:

    line 66
  12. Very specific:

    Create a standalone project in samples/ with matching directory and project names

    line 68
  13. Distinctive:

    Add the project to the solution file

    line 70

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

AGENTS.md

Instructions for AI coding agents working in the .NET codebase.

Build, Test, and Lint Commands

See ./.github/skills/build-and-test/SKILL.md for detailed instructions on building, testing, and linting projects.

Project Structure

See ./.github/skills/project-structure/SKILL.md for an overview of the project structure.

Pull Requests

See ./.github/skills/pull-requests/SKILL.md for guidance on writing PR descriptions and handling/resolving PR review comments.

Core types

  • AIAgent: The abstract base class that all agents derive from, providing common methods for interacting with an agent.
  • AgentSession: The abstract base class that all agent sessions derive from, representing a conversation with an agent.
  • ChatClientAgent: An AIAgent implementation that uses an IChatClient to send messages to an AI provider and receive responses.
  • IChatClient: Interface for sending messages to an AI provider and receiving responses. Used by ChatClientAgent and implemented by provider-specific packages.
  • FunctionInvokingChatClient: Decorator for IChatClient that adds function invocation capabilities.
  • AITool: Represents a tool that an agent/AI provider can use, with metadata and an execution delegate.
  • AIFunction: A specific type of AITool that represents a local function the agent/AI provider can call, with parameters and return types defined.
  • ChatMessage: Represents a message in a conversation.
  • AIContent: Represents content in a message, which can be text, a function call, tool output and more.

External Dependencies

The framework integrates with Microsoft.Extensions.AI and Microsoft.Extensions.AI.Abstractions (external NuGet packages) using types like IChatClient, FunctionInvokingChatClient, AITool, AIFunction, ChatMessage, and AIContent.

Key Conventions

  • Command output capture: When running dotnet build, dotnet test, dotnet format, or similar commands, redirect output to a temp file first (e.g., dotnet build --tl:off 2>&1 | Out-File $env:TEMP\build.log), then analyze the file as needed. This avoids re-running expensive commands when the initial analysis misses something.
  • Encoding: All new files must be saved with UTF-8 encoding with BOM (Byte Order Mark). This is required for dotnet format to work correctly. When using PowerShell Set-Content, always pass -Encoding UTF8BOM to preserve the BOM (e.g., Set-Content $file $content -NoNewline -Encoding UTF8BOM).
  • Copyright header: // Copyright (c) Microsoft. All rights reserved. at top of all .cs files
  • XML docs: Required for all public methods and classes
  • Async: Use Async suffix for methods returning Task/ValueTask
  • Private classes: Should be sealed unless subclassed
  • Config: Read from environment variables with UPPER_SNAKE_CASE naming
  • Tests: Add Arrange/Act/Assert comments; use Moq for mocking; test methods returning Task/ValueTask must use the Async suffix.

Key Design Principles

When developing or reviewing code, verify adherence to these key design principles:

  • DRY: Avoid code duplication by moving common logic into helper methods or helper classes.
  • Single Responsibility: Each class should have one clear responsibility.
  • Encapsulation: Keep implementation details private and expose only necessary public APIs.
  • Strong Typing: Use strong typing to ensure that code is self-documenting and to catch errors at compile time.

Sample Structure

Samples (in ./samples/ folder) should follow this structure:

  1. Copyright header: // Copyright (c) Microsoft. All rights reserved.
  2. Description comment explaining what the sample demonstrates
  3. Using statements
  4. Main code logic
  5. Helper methods at bottom

Configuration via environment variables (never hardcode secrets). Keep samples simple and focused.

When adding a new sample:

  • Create a standalone project in samples/ with matching directory and project names
  • Include a README.md explaining what the sample does and how to run it
  • Add the project to the solution file
  • Reference the sample in the parent directory's README.md

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.