DEV Community

Cover image for This week in Cursor + .NET — 7 rules (week ending October 18, 2026)
Agentic Architect
Agentic Architect

Posted on Originally published at agentic-architect.dev

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 the AI from quietly losing cancellation half-way down a call chain.

→ Permalink on the blog

Rule 7: IHttpClientFactory Discipline

Sat 17 Oct

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.

→ Permalink on the blog

Rule 6: TimeProvider Injection

Fri 16 Oct

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.

→ Permalink on the blog

Rule 5: Minimal API Groups

Thu 15 Oct

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.

→ Permalink on the blog

Rule 4: Validator Enforcement

Wed 14 Oct

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.

→ Permalink on the blog

Rule 3: Structured Logging

Tue 13 Oct

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.

→ Permalink on the blog

Rule 2: Persistence Boundaries

Mon 12 Oct

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.

→ 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)