AI usage in .NET development
Unresolved research. This topic is evidence that research-topic gathered, waiting on resolve-research. It isn't an opinion, and it can cite unvetted material. Follow the opinions instead.
Treat a coding agent as a fast, untrusted contributor, and make it answer to the build you already have. The gates this repository already recommends do most of the work: warnings as errors, nullable warnings as errors, analyzers in the build, pinned packages, and a real test suite. Add three things:
- Ground the agent in skills and live package data instead of its training data, and audit a skill pack against these opinions before you install it.
- Never accept tests the agent wrote after the code as evidence that the code works.
- Run an agent with unattended permissions inside an isolation boundary.
Since aaron-stannard was admitted (#90, 2026-09-25), the roster covers most of this.
Two unmarked, non-vendor, .NET-specific sources anchor it: aaron-stannard on verifying agent-written code, and andrew-lock on isolation.
The rest is vendor writing about vendor tools (dotnet-blog and jetbrains-dotnet), and sources whose notes either steer citations away from their 2026 AI writing (mark-seemann and ardalis) or mark them Corroborate. (jeremy-miller).
This topic covers using agents to write and maintain .NET code. Building AI features into .NET applications is a separate question, noted at the end.
What the repository already says
No opinion mentions AI, but three already contain most of the guardrails:
- ci.md opens with "Treat supply-chain security as a requirement": SHA-pinned actions, a pinned SDK and packages, and limits on which package assets can run at build time.
- ci.md also makes warnings errors in every build, and asks for a comment that says why on every suppression. That's the rule aimed most directly at an agent that silences a warning to get a green build.
- csharp.md makes nullable warnings errors, and sets analyzers to
latest-recommendedwithEnforceCodeStyleInBuild, so the compiler rejects more agent mistakes before review. - testing.md holds tests to the same review standard as production code, which agent-written tests tend to miss.
Verification: the build is the reviewer, and agent-written tests aren't evidence
Gate agent output on checks it can't argue past, and don't count tests the agent wrote after the code.
- Aaron Stannard's greenfield case study is the most concrete .NET account on the roster. The agent "authored lots of anemic tests that checked the 'has test coverage' box without really testing the functionality thoroughly". What held was
TreatWarningsAsErrors, which he enabled "because this prevents all sorts of rot from setting into the code base", and Verify snapshots with approval files in source control. He also enabled the Aspire MCP server so the agent could "click test" the whole application through Playwright, with full OpenTelemetry traces. (Stannard: Software 2.0: Planning and Verifying a Greenfield Project, 2026-03-13,aaron-stannard) - He names the one narrow case where he stops reading agent-written code. The task must be narrow, the output exhaustively verifiable ("Verification tries to be exhaustive by design; testing is meant to be indicative"), and the feedback fast. His parser met all three, with thousands of real commands regression-tested on every change. Otherwise, "you should definitely be reading most LLM-authored code in order to understand what it does", and he excludes end-user applications, with "user data, secrets, connections to external systems". (Stannard: A Security-Critical Project Where I Don't Read the Code, 2026-08-10,
aaron-stannard) - Mark Seemann explains why tests written after the fact fail. LLM-generated tests for existing code are "tests as ceremony, rather than tests as an application of the scientific method", because a test's value as evidence comes from seeing it fail. His remedy: break the code, confirm the test fails, then revert. Better still, write the tests first and let the model implement against them. (Seemann: AI-generated tests as ceremony, 2026-01-26) In "The hailo effect" (2026-04-06), he adds that "LLM friendliness does not entail competency".
Limit:
mark-seemann's notes say to cite his C# and .NET posts, and both of these are language-agnostic. Stannard's .NET report of the same failure is what makes the argument citable. - Jeremy Miller reports the productive side after two weeks of Claude Code on Marten and Wolverine: "great when you have very detailed compliance test frameworks that the AI tools can use to verify the completion of the work". (Miller: 2 Weeks of Claude Code for Me, 2026-02-14,
jeremy-miller, Corroborate.) All three agree on substance: the guardrail is checks the agent didn't write. They differ in temperament: Miller and Stannard welcome the throughput, and Seemann doubts that the output deserves trust. - Stannard's dotnet-slopwatch flags the shortcuts an agent takes to reach green: skipped tests,
#pragma warning disable,<NoWarn>, emptycatchblocks,Task.Delayin tests, and inline versions that bypass Central Package Management. Conflict: It's his own tool, which his notes flag wherever it's named. ci.md cites the skill for its suppression rule, with one difference: the opinion allows a suppression that gives its reason, and slopwatch flags every one against a baseline.
A direct disagreement with csharp.md.
Stannard found the .editorconfig checks "were largely worthless and burned millions of tokens over 1-2 months on trivial issues like whether or not there was an extra line ending in each .cs file. I removed that check entirely."
csharp.md recommends EnforceCodeStyleInBuild, and ci.md runs dotnet format --verify-no-changes in a job of its own.
One reconciliation keeps the rule: have the agent run dotnet format, which fixes whitespace and style mechanically, before it builds, so it never reasons about a formatting diagnostic.
Whether that avoids the cost he measured is untested, and adopting it is the maintainer's decision. It's the one place this topic would change an existing opinion instead of adding to one.
Skill packs: grounding that needs auditing
Prefer skills from the platform or package owner, give agents live package data, and read a pack before you trust it.
A model's .NET knowledge is months out of date at best, so an unguided agent picks xUnit v2, Newtonsoft.Json, or a package version that doesn't exist.
Skills fix that, but a skill pack is someone's opinions in a form the agent obeys, and both packs examined here ship samples that contradict this repository.
- dotnet/skills, from the .NET team: about 100 skills across 16 plugins as of 2026-09-25. Each skill is scored against a no-skill baseline, without assuming "more context always yields better results" (.NET Blog: Extend your coding agent with .NET Skills, 2026-03-09,
dotnet-blog). A skill value dashboard publishes activation and not-passed rates per model. Three caveats, from the repository itself:- Its only test-authoring skill is
writing-mstest-tests, anddotnet-test-migrationconverts xUnit to MSTest, against testing.md's xUnit v3 choice. - Two MSBuild skills still show xUnit
2.7.0and2.9.0in their samples. - Its
dotnet11plugin covers .NET 11 APIs, in preview as of 2026-09-25 and not an opinion.
- Its only test-authoring skill is
- Aaronontheweb/dotnet-skills, cited as
aaron-stannardfor the skills he wrote, and only for their principles, never their samples (see Vetting dotnet-skills). MIT licensed, created 2025-11-12, 1,187 stars, and v1.6.0 on 2026-09-16. It has 37 skills and 6 subagents for Claude Code, Codex, Copilot, and OpenCode, strongest on Akka.NET, Aspire, and testing, which the Microsoft pack barely covers.- Its evaluations are real but small. dotnet-skills-evals (2026-02-20) covered only the five Akka.NET skills. With a skill loaded, Sonnet beat its no-skill baseline in 13 of 15 tasks, a mean gain of 1.60 on a 1-to-5 scale. Sonnet was also the judge, and 15 cases is a signal, not a result.
- Two findings generalise. A terse routing index of about 15 lines in the system prompt beat listing every skill's full description, on every model tested. Cutting skills over 500 lines down to 500 helped the general-knowledge skills and hurt the specialised ones, which argues for a short
SKILL.mdwith reference files loaded on demand. - Nothing compiles its samples. Its own
AGENTS.mdsays "There is no build system, tests, or compiled output." Its release notes record fixing "fabricated APIs, compile errors" in the OpenTelemetry skill (v1.4.1), and guidance that wrongly called adding optional parameters binary-compatible. The corrections are to its credit, and they're why the table below still finds live defects. - Its recommended router snippet begins "Prefer retrieval-led reasoning over pretraining for any .NET work." That's the grounding argument in one line, and it applies to this repository's opinions as much as to his skills.
- Commercial packs are arriving. JasperFx sells Critter Stack AI Skills for its own libraries (Miller: Introducing the Critter Stack AI Skills, 2026-05-20,
jeremy-miller, Corroborate., conflict recorded). This shows a trend, not a recommendation. - Tool-backed skills measure best. Across 80 runs, JetBrains'
dottrace-analyzeskill, which gives the agent profiler snapshots, raised diagnosis accuracy from 4.71 to 8.15 out of 10. It more than doubled perfect root-cause identifications, from 20 to 48, and in one scenario cut a run's cost from $3.74 to $2.58 because the agent stopped exploring. (JetBrains: Your AI Agent Keeps Missing The Real Bottleneck, 2026-06-25,jetbrains-dotnet) Therefactoring-codeskill works the same way, calling Rider's refactoring engine instead of editing text (JetBrains: Rider Hands AI Agents The Keys To Its Refactoring Engine, 2026-08-19). Both are a vendor measuring its own paid tool once. - Live package data: The NuGet MCP server gives agents current package data, private feeds included, and resolves vulnerable or conflicting dependencies to the lowest compatible safe version (.NET Blog: Announcing the NuGet MCP Server Preview, 2025-08-14,
dotnet-blog). Microsoft Learn (updated 2026-01-20) documents it as built into Visual Studio 2026, and run elsewhere through the .NET 10 SDK'sdnx. Its coding-agent workflow still installs a preview SDK, and no GA announcement was found, so its status is unclear as of 2026-09-25, and it isn't an opinion. - Skills inside packages: The .NET team is testing skills that ship inside a NuGet package, in the same
SKILL.mdformat, because "New NuGet packages will always be ahead of model training and can benefit from just-in-time skill delivery". Without one, an agent learns a package from its README or by reflecting over the assembly, which costs tokens. A skill from a dependency is instructions from a third party, so the isolation rules below apply to it. (.NET Blog: Delivering Skills in NuGet packages, 2026-11-03,dotnet-blog)
dotnet-skills against this repository's opinions
Its csharp-coding-standards skill agrees with this repository on direction: nullable enabled, ArgumentNullException.ThrowIfNull at boundaries, switch expressions, and TreatWarningsAsErrors.
The specifics differ.
Each row was checked on 2026-09-25, and the three code rows were compiled or run against SDK 10.0.400:
| dotnet-skills says | This repository says | Verified |
|---|---|---|
Records with IReadOnlyList<T> members (ShoppingCart, Order), and record for "domain entities" |
csharp.md: Records: a collection member breaks value equality | Two carts with identical contents compare unequal |
record EmailAddress validates in its constructor, but exposes Value { get; init; } |
csharp.md: Records: with doesn't re-run the constructor |
new EmailAddress("a@b.c") with { Value = "junk" } succeeds |
readonly record struct OrderId(string Value) plus a validating OrderId(string value) constructor |
Code samples must compile (agents/ |
Fails with CS0111: the constructor duplicates the primary one. default(OrderId) also skips any validation a struct holds. |
xUnit 2.9.x and FluentAssertions 6.12.0/7.0.0 in package-management and project-structure |
testing.md: xUnit v3 on Microsoft.Testing.Platform. His own team removed FluentAssertions from Akka.NET on 2026-06-10 | Read from the skill files |
<PackageReference Include="xunit" Version="*" /> in testcontainers and playwright-blazor |
ci.md: CI must never pick up a version the repository didn't choose. His own slopwatch flags inline versions as a Central Package Management bypass | Read from the skill files |
The pack states current principles and ships stale or broken examples. An agent follows the example, not the principle, so audit a pack's samples. Stale test-package pins appear in the Microsoft pack too, so this comes from uncompiled samples, not one author.
Vetting dotnet-skills
aaron-stannard's admission (#90) excluded the repository in a note, without vetting it.
Documentation written in a repository counts under the admission rules, so the exclusion needed evidence.
The criteria, applied to the repository as a source:
| Criterion | Evidence |
|---|---|
| Longevity | Created 2025-11-12, with 82 commits and v1.6.0 on 2026-09-16. Active, but under a year old, well short of two. |
| Depth | Mixed. aot-trimming, csharp-nullable-reference-types, and the OpenTelemetry suite are reference-grade: the workers found no defects, and they cover ground no opinion here does. csharp-coding-standards, package-management, and project-structure restate principles over stale examples. It's the only pack examined that publishes evaluations, and they're small. |
| Accuracy | The blocker. Nothing compiles the samples, as its AGENTS.md says. Verified on SDK 10.0.400: CS0246 in every testcontainers sample against the Testcontainers version its Version="*" restores, and CS0111 in a csharp-coding-standards value object, plus the record and package defects in the tables above. In its favour, its release notes record corrections, including fabricated APIs and a wrong binary-compatibility rule. |
| Independence | Stannard's Petabridge conflict applies here too: six skills and a subagent cover Akka.NET, and slopwatch is his own tool. Authorship is split: 68 of 82 commits are his, but the strongest skills came largely from Daniel Marbach, Mauro Servienti, and Tomasz Masternak of Particular Software. Admitting the repository would admit unvetted bylines, the blocker recorded for duende-blog. |
Decision: merged into aaron-stannard, after a first pass watch-listed it as dotnet-skills the same day.
The track record follows the person, and he has sixteen years of it, so the repository's age was never the right blocker.
The two real concerns became usage limits in his notes instead of a separate ID:
skills written by Particular Software's engineers aren't citable under his ID, and a skill he wrote is cited for its principle, never for an uncompiled sample.
Crossover with other opinions
Most of the 37 skills reach past csharp.md, so the pack was mapped against every opinion on 2026-09-25.
Worker agents did the reading. Every conflict below was rechecked against the skill file, and code was compiled where a claim needed it.
Four worker claims failed that check and are left out:
- The Akka.NET
ITimeProviderregistration compiles: it's Akka's own interface, not a misspelt BCL type. - The
Context.Child(...).GetOrElse(...)lookup compiles and routes correctly, becauseGetOrElsetreatsNobodyas missing. - A local tool manifest doesn't contradict
project-structure.md, whosednxadvice is for one-shot tools. - The Verify package complaint was right, for a different reason (see the table).
Across the pack: Six skills ship CI workflows pinned to dotnet-version: 9.0.x, and none to 10. There are 22 uses: lines on mutable action tags and none on a commit SHA, which ci.md forbids.
| Opinion | Skill | Conflict, verified |
|---|---|---|
| testing.md: Coverage | crap-analysis |
Recommends 80% line and 60% branch thresholds in a coverage.props "for CI enforcement". testing.md uses coverage "to find untested code, not to score quality". |
| testing.md | testcontainers |
Every sample uses new TestcontainersBuilder<TestcontainersContainer>(), which fails with CS0246 against Testcontainers 4.15.0, the version its own Version="*" reference restores. The typed builders replaced it. |
| testing.md | snapshot-testing, verify-email-snapshots |
dotnet add package Verify.Xunit, whose current 31.12.5 depends on xunit.extensibility.execution 2.9.3, so it pulls in xUnit v2. xUnit v3 needs Verify.XunitV3. |
| testing.md | aspire-integration-testing, akka-testing-patterns |
Reference Microsoft.NET.Test.Sdk with xunit.runner.visualstudio, the VSTest pairing testing.md rules out. The Aspire skill also sleeps with Task.Delay(2000), which the pack's own slopwatch flags. |
| logging.md | aspire-service-defaults |
Presents AddOpenTelemetry().UseOtlpExporter() as the whole setup. logging.md: the in-process exporter "batches in memory with no disk queue", so run a collector on localhost. |
| project-structure.md | project-structure |
Its complete Directory.Build.props omits UseArtifactsOutput, EnforceCodeStyleInBuild, and nullable-as-errors. Its CPM setup omits CentralPackageTransitivePinningEnabled, and its global.json has no test.runner, all of which the templates set. It pins SDK 9.0.200 and net8.0/net9.0. |
| architecture.md | database-performance |
Splits each feature into IUserReadStore and IUserWriteStore implementations: the pattern-named layering architecture.md argues against, although the files sit inside a feature folder. |
| ci.md | local-tools |
Gates formatting with CSharpier, where ci.md uses dotnet format --verify-no-changes. A choice, not an error, but an agent following the skill replaces the repository's check. |
Where the pack stays on principle, it agrees. aot-trimming matches runtime-performance.md: Native AOT and the source-generated JSON advice in testing.md.
csharp-type-design-performance matches its ValueTask and FrozenDictionary guidance, and csharp-concurrency-patterns its rules on blocking and ConfigureAwait.
efcore-patterns matches data-access.md on ExecuteUpdateAsync, r3-reactive-extensions matches datetime.md on TimeProvider and FakeTimeProvider exactly, and slopwatch matches the suppression rule in ci.md.
Gaps the pack covers and the opinions don't.
These are harvest leads, not guidance. A skill Stannard wrote is citable as aaron-stannard for its principle, but several of these came from other authors, and none of the samples are compiled.
Where his blog covers the same ground, the lead is citable now:
- Citable through his blog: Public API compatibility, which has no opinion file.
csharp-api-designteaches extend-only design, the binary-breaking optional-parameter trap, and API approval tests, and "Extend-Only Design" and "OSS Compatibility Standards" make the same arguments. His "Stop Failing Thegit clone && runTest" (2025-10-17) supports the Testcontainers and Aspire first-run material, which no opinion covers. - Needs another roster source:
- The unsourced TODOs in data-access.md, which
efcore-patternsanddatabase-performancecover: tracking defaults, the migrations workflow,ExecutionStrategywith transactions inside it, split queries against cartesian explosion, andIDbContextFactoryfor long-lived owners.aspnet-core.mdappliesAsNoTracking()per query, and the skill makes no-tracking the global default, so the maintainer has to choose. - The Options pattern (
ValidateOnStart,IValidateOptions<T>, and theIOptions,IOptionsSnapshot, andIOptionsMonitorlifetimes), and DI registration conventions, including the scoped-in-singleton trap. No opinion covers either. - Metrics:
logging.mdcovers logs and traces, neverMeter, instrument naming, or cardinality. - Trimming attributes and the IL2xxx and IL3xxx warnings, beyond
runtime-performance.md's one paragraph. - The escalation from
asynctoChannel<T>to Rx to actors, and serialization formats beyond System.Text.Json. - Blazor end-to-end testing detail from
playwright-blazor, such as waiting on DOM elements instead of network idle, for ui-frameworks.md. DOTNET_HOSTBUILDER__RELOADCONFIGONCHANGE=falsefor test suites that start many hosts, includingWebApplicationFactorysuites.
- The unsourced TODOs in data-access.md, which
Isolation and supply chain
- Run an agent with bypassed permission prompts only inside a microVM. Andrew Lock recommends Docker Sandboxes because "unlike containers, which share the host kernel, each sandbox has its own kernel". Network traffic goes through a proxy that blocks host access and injects credentials, so the agent never holds them. He pairs each sandbox with its own git worktree, as this repository already works. (Lock: Running AI agents safely in a microVM using docker sandbox, 2026-04-07,
andrew-lock) The post doesn't cover a .NET SDK or NuGet configuration inside the sandbox. - Hallucinated package names are an attack surface. Across 576,000 samples from 16 models, at least 5.2% of packages recommended by commercial models didn't exist, and at least 21.7% from open-source models, with 205,474 unique invented names. Attackers register names that models repeat ("slopsquatting"). (USENIX Security 2025: We Have a Package for You!, unvetted) The study covers two languages, neither of them C#, and no roster source has measured it for NuGet.
ci.mdalready has the mitigations: Central Package Management, no floating versions, and a person choosing each new dependency.
Cost
Recorded for the decision, not as guidance: every source here is limited.
Steve Smith argues that flat-rate agent subscriptions are an "open bar" that agentic use breaks. He predicts prices 10 to 100 times their January 2026 level by the end of 2027, and advises treating AI tooling as a portfolio bet while the team keeps its own skills sharp. (Smith: AI Benefits - But at What Cost?, 2026-03-19, ardalis, Corroborate., whose notes steer citations to his .NET posts)
Stannard makes the same market argument in "Escaping the LLM Coding Rat Race" (2026-07-27): "There's only one winner in the AI coding rat race: your inference provider."
In "There Has Never Been a Better Time to be a Junior Developer" (2025-08-22), he argues that subsidised pricing won't last.
Both are essays, which aaron-stannard's notes put outside what a citation can rest on.
Building AI into .NET applications (out of scope here)
Starting points for a follow-up topic, not weighed:
Microsoft.Extensions.AI(IChatClient) reached GA on 2025-05-21 (.NET Blog: AI and Vector Data Extensions are now Generally Available,dotnet-blog).- Microsoft Agent Framework reached 1.0 on 2026-04-03, combining Semantic Kernel and AutoGen (Microsoft Agent Framework: Microsoft Agent Framework Version 1.0, the package's own release post, so a reference).
- The C# MCP SDK and a
dotnet new mcpservertemplate are official (Microsoft Learn: Create a minimal MCP server).
Closing the loop
- Ready for
resolve-research. Stannard's admission filled the gap that made this topic thin. Add it to existing files instead of a new one:testing.md: agent-written tests aren't evidence, citingaaron-stannardwithmark-seemann.ci.md: agent isolation (andrew-lock), and auditing skill packs as dependencies.csharp.md: only if the maintainer settles the.editorconfigquestion below.
- Open question for the maintainer: Keep
EnforceCodeStyleInBuildand have agents rundotnet formatfirst, or accept Stannard's measured cost and relax it for agent loops. This could be a House: call. - Harvest leads from the crossover map: The API compatibility material is citable now through
aaron-stannard's blog and has no opinion file, so it might need its own topic. Thedata-access.mdTODOs, Options and DI, and metrics each need a roster source first. - dotnet-skills is merged into
aaron-stannard, limited to the skills he wrote and their principles. Revisit the sample limit if the repository starts compiling its samples. - Possible
vet-sourcecandidate: Daniel Marbach, who wrote much of the pack's strongest material (AOT and trimming, nullable reference types, and OpenTelemetry). Vetting him could reach that material without admitting the repository. - Another
vet-sourcecandidate, unvetted: Rockford Lhotka (blog.lhotka.net), whose 2026 series on building agents in .NET includes "Tools and Skills: Better Together". - Harvest lead: Oskar Dudycz's "Vibing, Harness and OODA loop" (2026-04-26), not yet read.
oskar-dudyczis already citable.