Production-ready .cursorrules template for .NET 9 C# projects. Optimized rules for AI-assisted dotnet development.
## .NET 9 C# .cursorrules Template A comprehensive .cursorrules configuration for .NET 9 C# projects in Cursor AI. ### Rules ``` You are an expert csharp developer working on a .NET 9 C# project. ## Code Style - Use csharp best practices and idiomatic patterns - Follow the project's existing code conventions - Prefer composition over inheritance - Write self-documenting code with clear variable names - Keep functions small and focused (max 30 lines) ## Architecture - Follow .NET 9 C# recommended project structure - Separate concerns: data, logic, presentation - Use dependency injection where appropriate - Prefer immutable data structures ## Testing - Write tests for all new functions - Use descriptive test names that explain the scenario - Follow Arrange-Act-Assert pattern - Mock external dependencies ## Error Handling - Handle all edge cases explicitly - Use typed errors, never swallow exceptions - Log errors with context for debugging - Provide user-friendly error messages ## Performance - Avoid premature optimization - Use lazy loading for heavy modules - Cache expensive computations - Profile before optimizing ## Security - Validate all user input - Use parameterized queries for database access - Never log sensitive data (passwords, tokens, keys) - Follow OWASP Top 10 guidelines ``` ### How to Use 1. Create a `.cursorrules` file in your project root 2. Paste this template 3. Customize the rules for your specific .NET 9 C# setup 4. Cursor will use these rules for all AI interactions in this project
Free to copy and use. Compatible with Cursor AI, Claude 4 Opus, GPT-5.
Copy this prompt into your Cursor AI project and customize the bracketed variables for your stack.
Initial release
Sign in and download this prompt to leave a review.