OverviewHistoryStatsSecurity
npx skills add ...
Documentation
SKILL.md
npx skills add mindrally/skills --skill blazor
Guidelines for Blazor development including component lifecycle, state management, and performance optimization
npx skills add mindrally/skills --skill blazor
You are an expert in Blazor development with deep knowledge of both Blazor Server and Blazor WebAssembly.
OnInitialized/OnInitializedAsync: Initial setupOnParametersSet/OnParametersSetAsync: When parameters changeOnAfterRender/OnAfterRenderAsync: After DOM updatesDispose: Cleanup resourcesOnInitializedAsync for data loadingfirstRender in OnAfterRenderAsync@key for list itemsShouldRender() when appropriateStateHasChanged() judiciouslyStateHasChanged() when state changes externallyInvokeAsync for thread-safe updatesIErrorBoundary for custom handlingAuthenticationStateProviderAuthorizeView for conditional UI[Authorize] attribute on pages@key for dynamic lists@if<p>@message</p>
<input value="@inputValue" /><input @bind="inputValue" />
<input @bind="inputValue" @bind:event="oninput" /><button @onclick="HandleClick">Click</button>
<button @onclick="() => HandleClickWithParam(id)">Click</button>
<button @onclick="HandleClickAsync">Async Click</button><Virtualize Items="@items" Context="item">
<ItemContent>
<div>@item.Name</div>
</ItemContent>
</Virtualize><CascadingValue Value="@currentTheme">
<ChildComponent />
</CascadingValue>
<!-- In child component -->
[CascadingParameter]
public Theme CurrentTheme { get; set; }@inject HttpClient Http
private async Task LoadData()
{
users = await Http.GetFromJsonAsync<List<User>>("api/users");
}try
{
users = await Http.GetFromJsonAsync<List<User>>("api/users");
}
catch (HttpRequestException ex)
{
errorMessage = "Failed to load users";
}<ErrorBoundary>
<ChildContent>
<RiskyComponent />
</ChildContent>
<ErrorContent Context="ex">
<p>An error occurred: @ex.Message</p>
</ErrorContent>
</ErrorBoundary>[Fact]
public void ComponentRendersCorrectly()
{
using var ctx = new TestContext();
var cut = ctx.RenderComponent<Counter>();
cut.Find("p").MarkupMatches("<p>Current count: 0</p>");
cut.Find("button").Click();
cut.Find("p").MarkupMatches("<p>Current count: 1</p>");
}<AuthorizeView>
<Authorized>
<p>Welcome, @context.User.Identity?.Name!</p>
</Authorized>
<NotAuthorized>
<p>Please log in.</p>
</NotAuthorized>
</AuthorizeView>