Home › .NET / ASP.NET Core › Blazor (.NET 10) AGENTS.md
Blazor (.NET 10) AGENTS.md
AGENTS.md for Blazor Web Apps on .NET 10: render modes, components, forms and validation, state, and bUnit tests.
AGENTS.md.NET / ASP.NET Core
How to use
Save this as AGENTS.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.
Note: Review and test before use. Provided as is, without warranty. See Terms.
AGENTS.mdDownload # AGENTS.md: Blazor Web App
## Commands
`dotnet watch` · `dotnet build -warnaserror` · `dotnet test` (bUnit + xUnit)
## Render modes
- Static SSR by default. Opt in per component/page with `@rendermode InteractiveServer`, `InteractiveWebAssembly`, or `InteractiveAuto` only where interactivity is needed. Don't make the whole app interactive by default.
- Components used in WebAssembly mode live in the client project and must not reference server-only services.
## Components
- Small components with `[Parameter]` inputs and `EventCallback<T>` outputs; `[EditorRequired]` for mandatory parameters.
- Don't mutate parameters inside the child; raise an event instead.
- Lists render with `@key` on stable ids. Use `Virtualize` for long lists.
- Load data in `OnInitializedAsync`; with prerendering, avoid double loading (use `PersistentComponentState`/`[PersistentState]`).
- Dispose subscriptions and timers (`@implements IAsyncDisposable`).
- JS interop through a small module per feature (`IJSRuntime.InvokeAsync<IJSObjectReference>("import", ...)`), only after first render.
## Forms
`EditForm` with `Model`, `DataAnnotationsValidator`, `ValidationMessage`; static SSR forms use `[SupplyParameterFromForm]` and `FormName`. Antiforgery stays enabled.
## Security
Authorization with `[Authorize]`/`AuthorizeView` in the UI and again in the services/APIs it calls.
## Done
Build with no warnings, bUnit tests for new components, and the page works with JavaScript-heavy features tested in the browser.