This week in Cursor + .NET — 7 rules (week ending October 18, 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 8: CancellationToken Propagation Sun 18 Oct 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…
On Monday, October 12, 2026, senior C#/.NET engineers were reminded that Controllers should not contain database logic. All IQueryable access must remain in the Infrastructure layer to keep business logic pure and readable for the LLM.
Tuesday brought the importance of structured logging. Log messages must use ILogger with structured templates, steering clear of string interpolation. This ensures that when logs are fed back into Cursor for debugging, the AI can recognize the patterns instantly.
Wednesday reminded engineers to enforce FluentValidation rules on every MediatR Request. The AI must check the validator before writing handler logic, preventing "context rot" where the AI forgets business constraints.
Thursday saw the recommendation to use MapGroup and EndPoints for .NET 9 services. This keeps the context window lean and focused, allowing the AI to provide more accurate code suggestions compared to massive, bloated Controllers.
Friday emphasized the need to inject a TimeProvider, such as IClock, instead of letting Cursor hardcode DateTime.Now or DateTime.UtcNow in business logic. This makes time deterministic for tests and stops the AI from relying on static APIs when generating time-aware code.
On Saturday, October 17, the importance of using IHttpClientFactory was highlighted. Refusing to use new HttpClient() in any generated code and forcing Cursor to inject IHttpClientFactory or a typed client prevents classic socket-exhaustion bugs that AI-generated code might unintentionally introduce.
Finally, on Sunday, October 18, the rule about CancellationToken propagation was enforced. Every async method in the codebase should accept and forward a CancellationToken, preventing the AI from quietly losing cancellation half-way down a call chain.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.