{"@attributes":{"version":"2.0"},"channel":{"title":"Agentic Architect \u2014 Daily Senior Rule","link":"https:\/\/agentic-architect.dev\/blog\/","description":"One practical Cursor + C#\/.NET pattern per day. Field notes from building a stateful AI partner for production .NET codebases.","language":"en-gb","item":[{"title":"Rule 29: ValidateOnStart for Options","link":"https:\/\/agentic-architect.dev\/blog\/#2026-11-30","guid":"daily-rule-2026-11-30","pubDate":"Mon, 30 Nov 2026 09:00:00 +0000","description":"Bind settings with AddOptions<SmtpOptions>().BindConfiguration(\"Smtp\").ValidateDataAnnotations().ValidateOnStart(). A missing connection string or an invalid port then stops the app at boot, not on the first request that needs it at 3am. Cursor wires options without validation; require ValidateOnStart for every options class that has required values."},{"title":"Rule 28: Keyed Services Over Factory Switches","link":"https:\/\/agentic-architect.dev\/blog\/#2026-11-29","guid":"daily-rule-2026-11-29","pubDate":"Sun, 29 Nov 2026 09:00:00 +0000","description":"Since .NET 8 you can register several implementations of one interface with AddKeyedSingleton<IStorage, BlobStorage>(\"blob\") and inject the right one with [FromKeyedServices(\"blob\")]. Stop letting the AI generate a factory class with a switch on a string or enum that news up dependencies by hand. Keyed registration keeps lifetimes managed by the container."},{"title":"Rule 27: TypedResults in Minimal APIs","link":"https:\/\/agentic-architect.dev\/blog\/#2026-11-28","guid":"daily-rule-2026-11-28","pubDate":"Sat, 28 Nov 2026 09:00:00 +0000","description":"Return TypedResults.Ok(dto) and declare union return types like Results<Ok<OrderDto>, NotFound> instead of the untyped Results helpers. The compiler checks every branch, OpenAPI metadata is inferred without extra Produces calls, and handlers become unit-testable without an HTTP pipeline. Cursor defaults to IResult everywhere; make the typed form the house style."},{"title":"Rule 26: ProblemDetails for Every Error","link":"https:\/\/agentic-architect.dev\/blog\/#2026-11-27","guid":"daily-rule-2026-11-27","pubDate":"Fri, 27 Nov 2026 09:00:00 +0000","description":"Call AddProblemDetails() and UseExceptionHandler() so unhandled exceptions and bare status codes come back as RFC 9457 application\/problem+json instead of HTML or empty bodies. Endpoints return TypedResults.Problem or TypedResults.ValidationProblem, never a hand-rolled error object. Cursor invents a new error shape per controller; one rule gives every client a single format to parse."},{"title":"How to stop Cursor forgetting your database schema (and your project rules)","link":"https:\/\/agentic-architect.dev\/blog\/12-cursor-database-schema-efcore.html","guid":"https:\/\/agentic-architect.dev\/blog\/12-cursor-database-schema-efcore.html","pubDate":"Fri, 27 Nov 2026 22:00:00 +0000","description":"A committed EF Core schema digest, a glob-scoped rule for data-access code, and a drift test that keeps it honest."},{"title":"Cursor for C# and .NET in 2026: extensions, debugging and Unity","link":"https:\/\/agentic-architect.dev\/blog\/11-cursor-csharp-dotnet-setup.html","guid":"https:\/\/agentic-architect.dev\/blog\/11-cursor-csharp-dotnet-setup.html","pubDate":"Fri, 27 Nov 2026 21:30:00 +0000","description":"Why the C# Dev Kit won't run in Cursor, which C# extension to use instead, netcoredbg debugging, and the Unity setup."},{"title":"Claude Fable 5.2 for coding: price, effort levels, and when to use it","link":"https:\/\/agentic-architect.dev\/blog\/10-claude-fable-5-2-for-coding.html","guid":"https:\/\/agentic-architect.dev\/blog\/10-claude-fable-5-2-for-coding.html","pubDate":"Fri, 27 Nov 2026 21:00:00 +0000","description":"Fable 5.2 vs Mythos 5.2, what changed from Fable 5.1, cost per task at each effort level, and when it beats Opus 5.5."},{"title":"Teach Cursor Result<T> instead of throwing","link":"https:\/\/agentic-architect.dev\/blog\/04-cursor-result-not-throw.html","guid":"https:\/\/agentic-architect.dev\/blog\/04-cursor-result-not-throw.html","pubDate":"Thu, 21 May 2026 20:00:00 +0000","description":"Keep Cursor on Result\/ErrorOr when your team already rejected throw-based control flow."},{"title":"Seven words that stop Cursor hallucination loops","link":"https:\/\/agentic-architect.dev\/blog\/03-cursor-hallucination-loop-breaker.html","guid":"https:\/\/agentic-architect.dev\/blog\/03-cursor-hallucination-loop-breaker.html","pubDate":"Wed, 20 May 2026 08:00:00 +0000","description":"Break the correction spiral \u2014 seven words, or a circuit-breaker .mdc rule."},{"title":"The Scoped\u2192Singleton DI bug your AI just suggested (and how to catch it)","link":"https:\/\/agentic-architect.dev\/blog\/02-scoped-singleton-di-bug.html","guid":"https:\/\/agentic-architect.dev\/blog\/02-scoped-singleton-di-bug.html","pubDate":"Tue, 19 May 2026 08:00:00 +0000","description":"The .NET lifetime bug that ships silently \u2014 and the Cursor rule that catches it before merge."},{"title":"The Context Tax: Why every Cursor session costs you 15 minutes","link":"https:\/\/agentic-architect.dev\/blog\/01-the-context-tax.html","guid":"https:\/\/agentic-architect.dev\/blog\/01-the-context-tax.html","pubDate":"Mon, 18 May 2026 08:00:00 +0000","description":"The hidden cost senior engineers pay every morning \u2014 and a four-rule architecture for eliminating it."},{"title":"Rule 2: Persistence Boundaries","link":"https:\/\/agentic-architect.dev\/blog\/#2026-05-20","guid":"daily-rule-2026-05-20","pubDate":"Wed, 20 May 2026 09:00:00 +0000","description":"Never let the AI write database logic in your Controllers. Enforce a strict boundary where all IQueryable access stays in the Infrastructure layer. This keeps your business logic \"pure\" and readable for the LLM."},{"title":"Rule 8: CancellationToken Propagation","link":"https:\/\/agentic-architect.dev\/blog\/#2026-05-21","guid":"daily-rule-2026-05-21","pubDate":"Thu, 21 May 2026 09:00:00 +0000","description":"Every async method in your codebase should accept and forward a CancellationToken. Make it a rule that any new async signature without one is flagged. Stops the AI from quietly losing cancellation half-way down a call chain."},{"title":"Rule 9: Scoped Capture in Singleton","link":"https:\/\/agentic-architect.dev\/blog\/#2026-05-22","guid":"daily-rule-2026-05-22","pubDate":"Fri, 22 May 2026 09:00:00 +0000","description":"The single most expensive .NET runtime bug: a Singleton holding a Scoped service. Cursor cheerfully writes this without warning. Audit constructor parameters of any class registered as Singleton \u2014 if any are typically Scoped (DbContext, repositories, MediatR sender), flag it before merge."},{"title":"Rule 10: AsNoTracking for Reads","link":"https:\/\/agentic-architect.dev\/blog\/#2026-05-23","guid":"daily-rule-2026-05-23","pubDate":"Sat, 23 May 2026 09:00:00 +0000","description":"Every read-only EF Core query should call AsNoTracking. Add a rule that recognises query methods returning DTOs (not entities) and inserts the call. Cursor never does this by default and your read perf degrades silently across releases."},{"title":"Rule 11: Rethrow, Don't throw ex","link":"https:\/\/agentic-architect.dev\/blog\/#2026-05-24","guid":"daily-rule-2026-05-24","pubDate":"Sun, 24 May 2026 09:00:00 +0000","description":"throw ex resets the stack trace. throw preserves it. Cursor gets this wrong surprisingly often when generating catch blocks. Rewrite any naked throw ex to throw unless the exception has been explicitly wrapped."},{"title":"Rule 12: IOptionsSnapshot Over Raw Config","link":"https:\/\/agentic-architect.dev\/blog\/#2026-05-25","guid":"daily-rule-2026-05-25","pubDate":"Mon, 25 May 2026 09:00:00 +0000","description":"Business code should never call IConfiguration directly. Strongly-typed IOptions or IOptionsSnapshot bindings only. The AI loves to \"just grab the config value\" \u2014 refuse it and force a settings class with validation attributes."},{"title":"Rule 14: Sealed By Default","link":"https:\/\/agentic-architect.dev\/blog\/#2026-05-27","guid":"daily-rule-2026-05-27","pubDate":"Wed, 27 May 2026 09:00:00 +0000","description":"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."},{"title":"Rule 15: Records for Value Objects, Classes for Entities","link":"https:\/\/agentic-architect.dev\/blog\/#2026-05-28","guid":"daily-rule-2026-05-28","pubDate":"Thu, 28 May 2026 09:00:00 +0000","description":"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."},{"title":"Rule 16: async void Outside Event Handlers","link":"https:\/\/agentic-architect.dev\/blog\/#2026-05-29","guid":"daily-rule-2026-05-29","pubDate":"Fri, 29 May 2026 09:00:00 +0000","description":"async void is a deadlock and unhandled-exception trap everywhere except UI event handlers. The AI uses it routinely for \"fire and forget\" \u2014 wrong answer every time. Flag it on sight."},{"title":"Rule 17: ConfigureAwait false in Libraries","link":"https:\/\/agentic-architect.dev\/blog\/#2026-05-30","guid":"daily-rule-2026-05-30","pubDate":"Sat, 30 May 2026 09:00:00 +0000","description":"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."},{"title":"Rule 18: WebApplicationFactory for Integration Tests","link":"https:\/\/agentic-architect.dev\/blog\/#2026-05-31","guid":"daily-rule-2026-05-31","pubDate":"Sun, 31 May 2026 09:00:00 +0000","description":"In-memory EF Core providers lie. Use WebApplicationFactory with Testcontainers (SQL Server, Postgres) for real integration coverage. Cursor defaults to UseInMemoryDatabase \u2014 it passes locally and ships the bug to production. Flag the in-memory provider in test projects."},{"title":"Rule 19: NetArchTest for Boundaries","link":"https:\/\/agentic-architect.dev\/blog\/#2026-06-01","guid":"daily-rule-2026-06-01","pubDate":"Mon, 01 Jun 2026 09:00:00 +0000","description":"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."},{"title":"Rule 20: Source-Generated JSON Serialisation","link":"https:\/\/agentic-architect.dev\/blog\/#2026-06-02","guid":"daily-rule-2026-06-02","pubDate":"Tue, 02 Jun 2026 09:00:00 +0000","description":"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 \u2014 add a rule that flags new DTO classes and asks whether they should be source-generated."},{"title":"Rule 21: Channels for Producer Consumer","link":"https:\/\/agentic-architect.dev\/blog\/#2026-06-03","guid":"daily-rule-2026-06-03","pubDate":"Wed, 03 Jun 2026 09:00:00 +0000","description":"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."},{"title":"Rule 22: BackgroundService Over Task.Run","link":"https:\/\/agentic-architect.dev\/blog\/#2026-06-04","guid":"daily-rule-2026-06-04","pubDate":"Thu, 04 Jun 2026 09:00:00 +0000","description":"Long-running work in ASP.NET Core goes in a BackgroundService, not Task.Run inside a controller. Cursor will happily fire Task.Run and call it \"async work\" \u2014 your request thread will die mid-execution and you'll never know why. Catch Task.Run outside test code and propose a hosted service."},{"title":"Rule 23: No Bool Flag Parameters","link":"https:\/\/agentic-architect.dev\/blog\/#2026-06-05","guid":"daily-rule-2026-06-05","pubDate":"Fri, 05 Jun 2026 09:00:00 +0000","description":"SendEmail(string to, bool isHtml) should be SendHtmlEmail and SendPlainEmail. Bool flags hide branching that belongs in the type system. Flag any method signature with two or more bool parameters as a refactor candidate."},{"title":"Rule 24: ValueTask Only When Justified","link":"https:\/\/agentic-architect.dev\/blog\/#2026-06-06","guid":"daily-rule-2026-06-06","pubDate":"Sat, 06 Jun 2026 09:00:00 +0000","description":"ValueTask is a perf optimisation for hot paths that often return synchronously. It is not a drop-in for Task. Cursor swaps them around without thinking. Flag ValueTask returns and ask whether the method is actually mostly synchronous. If not, revert to Task."},{"title":"Rule 25: ActivitySource for OpenTelemetry","link":"https:\/\/agentic-architect.dev\/blog\/#2026-06-07","guid":"daily-rule-2026-06-07","pubDate":"Sun, 07 Jun 2026 09:00:00 +0000","description":"Logs alone won't debug a distributed system. Add a static readonly ActivitySource per project and wrap every external call (DB, HTTP, queue) in StartActivity. Cursor never adds OTEL spans on its own \u2014 give it a rule that recognises external-call patterns and proposes the trace."},{"title":"Rule 1: The Result Pattern","link":"https:\/\/agentic-architect.dev\/blog\/#2026-06-08","guid":"daily-rule-2026-06-08","pubDate":"Mon, 08 Jun 2026 09:00:00 +0000","description":"Stop using nulls for flow control. Use a Result object to force Cursor to handle success and failure cases explicitly. This removes a whole class of AI-generated logic errors in Web APIs, where a forgotten null check becomes a 500."},{"title":"Rule 3: Structured Logging","link":"https:\/\/agentic-architect.dev\/blog\/#2026-06-10","guid":"daily-rule-2026-06-10","pubDate":"Wed, 10 Jun 2026 09:00:00 +0000","description":"Enforce ILogger with structured templates. Never use string interpolation in logs. This ensures that when you feed logs back into Cursor for debugging, the AI recognizes the patterns immediately."},{"title":"Rule 4: Validator Enforcement","link":"https:\/\/agentic-architect.dev\/blog\/#2026-06-11","guid":"daily-rule-2026-06-11","pubDate":"Thu, 11 Jun 2026 09:00:00 +0000","description":"Every MediatR Request must have a FluentValidation rule. Force the AI to check the validator before writing handler logic. This prevents \"context rot\" where the AI forgets your business constraints."},{"title":"Rule 5: Minimal API Groups","link":"https:\/\/agentic-architect.dev\/blog\/#2026-06-12","guid":"daily-rule-2026-06-12","pubDate":"Fri, 12 Jun 2026 09:00:00 +0000","description":"Use MapGroup and EndPoints for .NET 9 services. It keeps the context window lean and focused, helping the AI provide more accurate code suggestions than it can with massive, bloated Controllers."},{"title":"Rule 6: TimeProvider Injection","link":"https:\/\/agentic-architect.dev\/blog\/#2026-06-13","guid":"daily-rule-2026-06-13","pubDate":"Sat, 13 Jun 2026 09:00:00 +0000","description":"Never let Cursor hardcode DateTime.Now or DateTime.UtcNow in business logic. Inject TimeProvider (or your own IClock) instead. This makes time deterministic for tests and stops the AI reaching for static APIs whenever it generates time-aware code."},{"title":"Rule 7: IHttpClientFactory Discipline","link":"https:\/\/agentic-architect.dev\/blog\/#2026-06-14","guid":"daily-rule-2026-06-14","pubDate":"Sun, 14 Jun 2026 09:00:00 +0000","description":"Refuse new HttpClient() in any generated code. Force Cursor to inject IHttpClientFactory or a typed client. The classic socket-exhaustion bug is exactly the kind of footgun an AI hands you without realising."},{"title":"Rule 13: Strongly-Typed IDs","link":"https:\/\/agentic-architect.dev\/blog\/#2026-06-20","guid":"daily-rule-2026-06-20","pubDate":"Sat, 20 Jun 2026 09:00:00 +0000","description":"OrderId as record struct OrderId(Guid Value) beats raw Guid everywhere. Stops the AI passing a CustomerId where an OrderId was expected \u2014 a bug the compiler can't catch with primitive obsession but catches instantly with domain primitives."}]}}