Skip to content
Agent Friendly Code

What to put in an AGENTS.md for .NET

Agents learned .NET from versions now out of support, so state the SDK pinned in global.json, the target framework, and which runner dotnet test uses. Since .NET 10, dotnet new sln writes .slnx, and dotnet test can run on Microsoft.Testing.Platform.

By Himanshu Singh · Updated · How we score →

Which commands should it list?

  • dotnet buildthe solution or project in the current directory
  • dotnet test --filter "FullyQualifiedName~Orders"a subset; TUnit uses --treenode-filter
  • dotnet format --verify-no-changesfails if formatting would change a file
  • dotnet user-secrets set "Db:Password" "…"development secrets, kept out of the repo

Write them as your repo runs them, with its package manager and flags, plus how to run one test.

What layout should it explain?

  • Which solution file is canonical (.slnx or .sln), and which project starts the app.
  • Where global.json and Directory.Packages.props are, and that versions go there, not in each .csproj.
  • Which projects are tests, and whether they run on VSTest or Microsoft.Testing.Platform.

What do agents get wrong?

  • No passwords or keys in appsettings.json; use dotnet user-secrets in development.
  • With Central Package Management, <PackageReference> has no Version; set it in Directory.Packages.props.
  • global.json sdk.version takes a full version such as 10.0.100, never 10 or 10.0.x.
  • dotnet test runs VSTest unless global.json sets "test": { "runner": "Microsoft.Testing.Platform" }.

From the official docs: learn.microsoft.com/sdk (new tab) · learn.microsoft.com/selective-unit-tests (new tab) · learn.microsoft.com/dotnet-format (new tab) · learn.microsoft.com/app-secrets (new tab) · learn.microsoft.com/central-package-management (new tab) · learn.microsoft.com/global-json (new tab). The rest of the file is the same for any project: what goes in an AGENTS.md.

.NET repos with an AGENTS.md or CLAUDE.md (6)

Built on .NET; 6 pass the AGENTS.md check in full.

.NET repos with an AGENTS.md or CLAUDE.md
RepoFileLengthStarsLanguageScore
files-community/FilesAGENTS.md 22,904 chars46.8k ★C#71.5
dotnet/mauiAGENTS.md 1,512 chars23.3k ★C#80.9
bitwarden/server.claude/CLAUDE.md 3,130 chars20.7k ★C#80.9
Sonarr/SonarrAGENTS.md 2,777 chars17.8k ★C#80.0
MudBlazor/MudBlazorAGENTS.md 33,922 chars10.7k ★C#73.7
OrchardCMS/OrchardCoreAGENTS.md 35,233 chars8.2k ★C#84.6

By language: C# AGENTS.md examples

More examples: Next.js · React · FastAPI · Flutter · Android · Rails · Vue · Laravel · Django · Angular · React Native · Spring Boot · iOS · all examples