AgentLint Verified 95/10099 C# / .NET repos analyzed
C# / .NET CLAUDE.md & AGENTS.md Template
dotnet test filters, nullable reference types, and analyzer enforcement from 99 C# repos.
# C# / .NET Project — C# / .NET Harness .NET 9 solution with nullable reference types enabled, xUnit tests, and analyzer warnings treated as errors. ## Commands - Fast targeted test: `dotnet test --no-restore --filter FullyQualifiedName~BillingTests` - Full suite: `dotnet test` - Format check: `dotnet format --verify-no-changes` - Strict build: `dotnet build --warnaserror` ## Rules - Don't silence nullable warnings with the null-forgiving operator `!`. Instead validate inputs and return typed results. Because `!` turns compile-time safety into runtime exceptions. - Don't block on async calls with `.Result` or `.Wait()`. Instead propagate `async`/`await` with `CancellationToken`. Because sync-over-async causes thread-pool starvation. - When editing EF Core models, read `docs/ef-migrations.md` first. ## Continuity - Keep `appsettings.Development.json` secrets in User Secrets, never in git, and update `HANDOFF.md`.
Most Adopted C# / .NET Rules Across Real Open-Source Repos
Measured across 99 public C# / .NET repositories in the 4,533-repo harness study:
dotnet-clitooling
Use dotnet CLI
65.7%65 repos
unit-teststesting
Write unit tests for all changes
47.5%47 repos
xunittesting
xUnit for testing
38.4%38 repos
async-await-csharppatterns
async/await patterns
35.4%35 repos
entity-frameworktooling
Entity Framework for ORM
30.3%30 repos
error-handlingpatterns
Proper error handling with context
28.3%28 repos
dockertooling
Docker for containerization
28.3%28 repos
conventional-commitsworkflow
Use conventional commit messages
22.2%22 repos
Essential Commands (Checks W1 & W7)
- install
- dotnet restore
- fastTest
- dotnet test --no-restore --filter FullyQualifiedName~TargetTests
- fullTest
- dotnet test
- lint
- dotnet format --verify-no-changes
- build
- dotnet build --warnaserror
Common C# / .NET Agent Pitfalls
- 01Skipping
--filterrebuilds and executes every test project in the solution. - 02Agents ignore nullable warnings with
!instead of proper null guards.