Add C#/.NET architectural guardrails rule#291
Add C#/.NET architectural guardrails rule#291agenticstandardcontact-byte wants to merge 4 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThis PR adds a new Cursor rule for C# and .NET architectural guardrails and adds a README entry linking to it from the backend and full-stack rules list. ChangesC# and .NET Architectural Rule
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@rules/csharp-dotnet-architecture.mdc`:
- Line 25: Update the rule that currently forbids "DateTime.Now" so it also
explicitly forbids "DateTime.UtcNow" (i.e., change the prohibition from
DateTime.Now to include DateTime.UtcNow) to match the anti-pattern section; edit
the line that lists forbidden APIs in the Domain rule (the entry containing
DateTime.Now) to add DateTime.UtcNow so both UTC and local DateTime access are
consistently disallowed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 7b05aa41-9f85-4e7d-b41a-16a49ce993cc
📒 Files selected for processing (2)
README.mdrules/csharp-dotnet-architecture.mdc
Co-authored-by: Cursor <cursoragent@cursor.com>
Rebase onto current main to clear README conflict (UTF-8), add self-repo Backend listing for rules/csharp-dotnet-architecture.mdc, and align Domain layer rule with DateTime.UtcNow prohibition (CodeRabbit). Co-authored-by: Cursor <cursoragent@cursor.com>
|
All
Happy to adjust anything else you need. Thanks. |
What this adds
rules/csharp-dotnet-architecture.mdcWhy
The current README has no dedicated C#/.NET entry under Backend and Full-Stack (Java/Spring, Rails, Laravel, FastAPI, NestJS are all represented, but not .NET). This contribution fills that gap with a scoped rule focused on the architectural concerns senior .NET developers actually want enforced by an AI pair.
What the rule does
Activates on
**/*.cs,**/*.csproj,**/*.sln. Five operating principles:Microsoft.EntityFrameworkCorereferences in Domain, blocks rawIConfigurationreads in Application).HttpClientinstantiated withnew, capturedDateTime.Nowin domain code,async voidoutside event handlers,Task.Result/.Wait()in async paths,throw ex;.recordvsclass, constructor injection,IOptions<T>,CancellationTokenflow.Frontmatter
Follows the format from CONTRIBUTING.md:
Attribution / licensing
Adapted from the open-source
arch-core-lite.mdcwhich is MIT-licensed. The original is mine; the file in this PR has been edited for tone and to remove product chrome per the CONTRIBUTING guideline ("keep descriptions neutral, practical, and focused on reusable Cursor rule value").Checklist
rules/with required frontmatter**/*)Summary by CodeRabbit