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.

More: all .NET / ASP.NET Core rules · all AGENTS.md rules

Related rules

C# / .NET Copilot path instructions

Path-specific Copilot instructions for C# files on .NET 10: nullable types, async, records, and logging.

GitHub Copilot.NET / ASP.NET Core

ASP.NET Core Copilot instructions

Copilot instructions for ASP.NET Core on .NET 9/10: minimal APIs, EF Core, nullable types, and xUnit tests.

GitHub Copilot.NET / ASP.NET Core

REST API design AGENTS.md

AGENTS.md for designing consistent HTTP/JSON APIs: resource naming, status codes, errors, pagination, and versioning.

AGENTS.mdAPI design

Celery background jobs AGENTS.md

AGENTS.md for Celery 5 task queues in Python/Django: idempotent tasks, retries, time limits, and safe enqueueing.

AGENTS.mdPython

Deno 2 AGENTS.md

AGENTS.md for Deno 2 projects: deno.json tasks, JSR and npm imports, permissions, and built-in tooling.

AGENTS.mdDeno

Express 5 API AGENTS.md

AGENTS.md for Express 5 REST APIs in TypeScript with zod validation, error middleware, and supertest.

AGENTS.mdNode.js / TypeScript

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.