All checks were successful
Caddy Manager CI build / docker (push) Successful in 1m16s
38 lines
2.1 KiB
Plaintext
38 lines
2.1 KiB
Plaintext
---
|
|
alwaysApply: true
|
|
---
|
|
# Blazor Development Workflow and Environment
|
|
|
|
## Development Environment
|
|
- All running, debugging, and testing of the Blazor app should happen in Cursor ide
|
|
- Code editing, AI suggestions, and refactoring will be done within Cursor AI
|
|
- Recognize that Cursor ide is installed and should be used for compiling and launching the app
|
|
|
|
## Blazor Code Style and Structure
|
|
- Write idiomatic and efficient Blazor and C# code
|
|
- Follow .NET and Blazor conventions
|
|
- Use Razor Components appropriately for component-based UI development
|
|
- Prefer inline functions for smaller components but separate complex logic into code-behind or service classes
|
|
- Async/await should be used where applicable to ensure non-blocking UI operations
|
|
|
|
## Blazor and .NET Specific Guidelines
|
|
- Utilize Blazor's built-in features for component lifecycle (e.g., OnInitializedAsync, OnParametersSetAsync)
|
|
- Use data binding effectively with @bind
|
|
- Leverage Dependency Injection for services in Blazor
|
|
- Structure Blazor components and services following Separation of Concerns
|
|
- Use C# 10+ features like record types, pattern matching, and global usings
|
|
- Logic code of the blazor component must be implemented in a separated .razor.cs code file.
|
|
- Prefer using the Tailwind classes to the Style attribute
|
|
|
|
## Performance Optimization
|
|
- Use asynchronous methods (async/await) for API calls or UI actions that could block the main thread
|
|
- Optimize Razor components by reducing unnecessary renders and using StateHasChanged() efficiently
|
|
- Minimize the component render tree by avoiding re-renders unless necessary, using ShouldRender() where appropriate
|
|
- Use EventCallbacks for handling user interactions efficiently, passing only minimal data when triggering events
|
|
|
|
## Testing and Debugging
|
|
- All unit testing and integration testing should be done in Cursor ide
|
|
- Test Blazor components and services using xUnit
|
|
- Use Moq for mocking dependencies during tests
|
|
- Debug Blazor UI issues using browser developer tools and Cursor ide's debugging tools for backend and server-side issues
|
|
- For performance profiling and optimization, rely on Cursor ide's diagnostics tools |