/blazor:blazorfrom blazor
Builds and debugs Blazor components and Blazor Web Apps: parameters and EventCallback, render modes, forms and validation, auth by render mode, shared state, data loading, prerendering, JS interop, and Blazor Server to Web App conversion. Use for any .razor file, a new Blazor project, data loading twice, or HttpContext null in a component.
Ships in blazor. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
For .razor/.razor.cs files and Blazor Web App projects (AddRazorComponents, blazor.web.js).
Not for: Razor Pages or MVC views (aspnet-core), the API endpoints a WebAssembly client calls (aspnet-core), EF Core query work (ef-core), general C# (csharp), component tests' runner syntax (dotnet-testing).
Every rule below depends on where a component runs. Before editing, determine:
Program.cs registrations (AddInteractiveServerComponents, AddInteractiveWebAssemblyComponents, both = Auto, neither = static SSR only).App.razor. <Routes @rendermode="..."/> means global interactivity; a bare <Routes /> means per-page, where only components with @rendermode are interactive..Client project means WebAssembly or Auto; interactive WebAssembly/Auto components must live there.RendererInfo, [ExcludeFromInteractiveRouting], AddAuthenticationStateSerialization) or .NET 10 ([PersistentState]). Don't use them on older TFMs.If the repo's CLAUDE.md or AGENTS.md records the render mode, trust it but confirm against App.razor.
| Mode | Runs where | Data access | Gotchas |
|---|---|---|---|
| Static SSR | Server, per request, no circuit | Inject services directly | No @onclick/@bind; forms post via [SupplyParameterFromForm] + FormName; [StreamRendering] for slow loads |
| Interactive Server | Server, SignalR circuit per user | Inject services; IDbContextFactory<T> for EF | Scoped = per circuit; never per-user state in singletons; prerender runs OnInitializedAsync twice |
| Interactive WebAssembly | Browser | HttpClient to APIs only | Code must be in .Client; no server-only types; runtime download on first visit |
| Interactive Auto | Server first, then browser | Through an abstraction with server and client implementations | Register services in both Program.cs files; test both paths |
[Parameter]; events flow up via EventCallback/EventCallback<T>, never Action/Func.[Parameter] public T Prop { get; set; } auto-properties. Don't use required or init: the renderer sets parameters, not object initializers. Mark must-pass parameters [EditorRequired].[Parameter] from inside the component; copy it to a private field in OnParametersSet.IReadOnlyList<T>; @key on elements and components rendered in loops.RenderFragment? ChildContent for slots, RenderFragment<TItem> with @typeparam TItem for templates..razor with @code for small components; move to .razor + .razor.cs (partial class) when the logic grows past about 50 lines.Component.razor.css) and classes, not inline style.Components run on a single-threaded synchronization context per circuit or tab.
await every task. No .Result, .Wait(), Task.Run, ContinueWith, new Thread, or concurrent collections in components.StateHasChanged() only for intermediate updates between awaits, or after work the framework doesn't know about.[JSInvokable] callbacks: await InvokeAsync(() => { ...; StateHasChanged(); }). Use an async void handler with try/catch that calls DispatchExceptionAsync(ex); never _ = InvokeAsync(...).CancellationTokenSource + await Task.Delay(interval, token), not System.Threading.Timer.IAsyncDisposable: unsubscribe, cancel, dispose; never call StateHasChanged there; null-check fields because disposal can run before initialization finishes.OnInitializedAsync runs twice: once static, once interactive. Persist state with [PersistentState] on a public property plus Prop ??= await Load() (.NET 10), or PersistentComponentState on older versions (references/prerendering.md).OnAfterRenderAsync(firstRender) or event handlers; JS doesn't exist during prerender (references/js-interop.md).HttpContext is only valid during static SSR. Interactive components read the user from [CascadingParameter] Task<AuthenticationState> (references/auth.md).<CascadingValue> doesn't cross render-mode boundaries; use AddCascadingValue/CascadingValueSource<T> in DI (references/state.md).dotnet build with zero new warnings (BL and RZ diagnostics included).dotnet run in the server project) and exercise the change in the mode it renders in; for Auto, check both a first visit (Server) and a reload after the runtime is cached (WebAssembly).dotnet-testing.Read the one that matches the task:
dotnet new blazor flags, what the template generates, Program.cs and App.razor wiring.EditForm, input components, validation, SSR form posts, file upload, double-submit.AuthorizeRouteView, [Authorize], Identity pages, WebAssembly auth state.CascadingValueSource<T>, scoped state services, lifetimes per mode.HttpClient registration, errors, reloading on parameter change, Auto/WebAssembly service abstraction.[ExcludeFromInteractiveRouting], RendererInfo.DotNetObjectReference, disposal and circuit loss._Host.cshtml, MapBlazorHub) to a Blazor Web App.references/auth.md (opens in a new tab)references/components.md (opens in a new tab)references/create-project.md (opens in a new tab)references/data.md (opens in a new tab)references/forms.md (opens in a new tab)references/js-interop.md (opens in a new tab)references/prerendering.md (opens in a new tab)references/server-to-webapp.md (opens in a new tab)references/state.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub adminhead/claude-plugins --plugin blazor