This Week In Cursor + .net — 7 Rules (week Ending November 22, 2026)
Every weekday a single, opinionated rule for senior C#/.NET engineers using Cursor. Here's the full week in one read — canonical posts live on the Agentic Architect blog.
7 daily senior rules
Rule 18: WebApplicationFactory for Integration Tests
Sun 22 Nov
In-memory EF Core providers lie. Use WebApplicationFactory with Testcontainers (SQL Server, Postgres) for real integration coverage. Cursor defaults to UseInMemoryDatabase — it passes locally and ships the bug to production. Flag the in-memory provider in test projects.
Rule 17: ConfigureAwait false in Libraries
Sat 21 Nov
Library code (non-ASP.NET) should ConfigureAwait false on every awaited Task. ASP.NET Core code should not. Cursor mixes the two contexts in the same solution. Detect the project type and enforce the right default.
Rule 16: async void Outside Event Handlers
Fri 20 Nov
async void is a deadlock and unhandled-exception trap everywhere except UI event handlers. The AI uses it routinely for "fire and forget" — wrong answer every time. Flag it on sight.
Rule 15: Records for Value Objects, Classes for Entities
Thu 19 Nov
Value objects (Money, Address, Coordinates) should be records. Entities with identity (Order, Customer) should be classes with an Id. Cursor mixes these constantly. A rule that classifies based on the presence or absence of an identity property keeps the distinction honest.
Rule 14: Sealed By Default
Wed 18 Nov
Mark every class sealed unless inheritance is explicitly planned. Stops Cursor inventing accidental inheritance hierarchies "for flexibility." Small but measurable virtual-call perf wins too.
Rule 13: Strongly-Typed IDs
Tue 17 Nov
OrderId as record struct OrderId(Guid Value) beats raw Guid everywhere. Stops the AI passing a CustomerId where an OrderId was expected — a bug the compiler can't catch with primitive obsession but catches instantly with domain primitives.
Rule 12: IOptionsSnapshot Over Raw Config
Mon 16 Nov
Business code should never call IConfiguration directly. Strongly-typed IOptions or IOptionsSnapshot bindings only. The AI loves to "just grab the config value" — refuse it and force a settings class with validation attributes.
Try one rule before you trust the whole kit
The free arch-core-lite.mdc is one drop-in Cursor rule that ends the morning re-explanation ritual. Install in 60 seconds, see whether Cursor actually remembers your DI lifetimes, and decide for yourself whether the full kit is worth £9.00.
-
Free sample:
arch-core-lite.mdcon GitHub - Full kit (£9.00, one-time): Agentic Architect Kit
- Daily rules feed: https://agentic-architect.dev/blog/
Canonical home for everything in this digest: https://agentic-architect.dev/blog/.