C#, ASP.NET Core Best Practices .cursorrules prompt file
About .cursorrules prompt file
What you can build
.NET Development Learning Platform: An online education platform that provides courses and tutorials focused specifically on .NET development practices, including C#, ASP.NET Core, and Entity Framework Core.
API Documentation Generator: A tool integrated with .NET projects to automatically generate and update API documentation using Swagger/OpenAPI, including XML comments and other annotations for enhanced details.
Code Style and Convention Validator: A software plugin that analyzes C# code for adherence to .NET coding conventions, suggesting improvements for consistency in naming, structure, and syntax.
Exception Handling Middleware Library: A pre-configured middleware package for .NET applications that implements best practices in error logging and global exception handling.
Entity Framework Query Analyzer: A tool that evaluates Entity Framework queries to optimize performance and detect common issues such as N+1 query problems.
API Version Management Service: A service that helps manage and implement versioning strategies for RESTful APIs built with ASP.NET Core.
Automated Caching Solution: A library that provides caching strategies using IMemoryCache or distributed caching for .NET projects, improving performance and data retrieval speeds.
Security Middleware Suite: A collection of pre-configured middleware for ASP.NET Core that secures APIs with authentication and authorization, including JWT authentication and CORS policy setup.
Code Mapping Tool with AutoMapper: An application that facilitates object-to-object mapping in .NET projects with AutoMapper, providing a user interface for configuring mappings visually.
Async Programming Helper: A toolkit that assists developers in implementing asynchronous programming practices in .NET, complete with examples and best practice checks.
Testing Utility Framework: A framework that simplifies unit and integration testing setup for .NET projects, incorporating popular testing libraries such as xUnit and MSTest.
Background Task Scheduler for .NET: A service for scheduling and managing background tasks using IHostedService or BackgroundService, designed for complex and high-load .NET applications.
RESTful API Design Assistant: An interactive guide and toolset for designing RESTful APIs using ASP.NET Core, helping ensure principles and conventions are followed effectively.
Performance Metrics Dashboard: A real-time performance monitoring dashboard for .NET applications, highlighting asynchronous operations efficiency, query execution times, and caching effectiveness.
Benefits
- Comprehensive guidance covering all development aspects from code style to security, ensuring a well-rounded .NET application.
- Emphasis on modern C# features and best practices, promoting efficient and up-to-date coding methodologies.
- Focus on performance and security with practical strategies for optimization and protection, critical for robust application development.
Synopsis
.NET backend developers can build robust, well-structured, and secure APIs following these .NET development standards for maintainable and scalable applications.
Overview of .cursorrules prompt
The .cursorrules file provides guidelines and best practices for a senior .NET backend developer specializing in C#, ASP.NET Core, and Entity Framework Core. It emphasizes coding style and structure, recommending concise and idiomatic C# code while adhering to .NET conventions. It outlines naming conventions, highlights the use of C# 10+ features, and stresses proper syntax and formatting. The file covers error handling, validation, API design, and performance optimization techniques such as async programming and caching. It promotes key conventions like dependency injection and testing methodologies, and stresses security practices including authentication and authorization. Lastly, it advocates for thorough API documentation using Swagger/OpenAPI and following Microsoft's documentation for best practices in various components.