DEV Community

Cover image for This week in Cursor + .NET — 6 rules (week ending June 28, 2026)
Agentic Architect
Agentic Architect

Posted on • Originally published at agentic-architect.dev

This week in Cursor + .NET — 6 rules (week ending June 28, 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.

6 daily senior rules

Rule 21: Channels for Producer Consumer

Sun 28 Jun

System.Threading.Channels beats BlockingCollection and beats roll-your-own queue plus SemaphoreSlim. The AI reaches for ConcurrentQueue every time and stitches it together by hand. A rule that detects producer/consumer patterns and proposes Channel will save you a class.

→ Permalink on the blog

Rule 20: Source-Generated JSON Serialisation

Sat 27 Jun

Reflection-based System.Text.Json is fine for prototypes. For hot paths and AOT, use JsonSerializable source generation. Cursor never thinks of this on its own — add a rule that flags new DTO classes and asks whether they should be source-generated.

→ Permalink on the blog

Rule 19: NetArchTest for Boundaries

Fri 26 Jun

Architectural rules belong in tests, not in code review. Encode them as NetArchTest assertions ("no class in Domain references EntityFrameworkCore") and they fail your build instead of your standup. Add the corresponding test whenever a new layer or project is introduced.

→ Permalink on the blog

Rule 18: WebApplicationFactory for Integration Tests

Thu 25 Jun

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.

→ Permalink on the blog

Rule 17: ConfigureAwait false in Libraries

Wed 24 Jun

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.

→ Permalink on the blog

Rule 15: Records for Value Objects, Classes for Entities

Mon 22 Jun

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.

→ Permalink on the blog


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.

Canonical home for everything in this digest: https://agentic-architect.dev/blog/.

Top comments (0)