Maintain Blazor Server components using BookStore conventions, reactive queries, and MudBlazor UI controls.

Install

mkdir -p .claude/skills/blazor && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/14278" && unzip -o skill.zip -d .claude/skills/blazor && rm skill.zip

Installs to .claude/skills/blazor

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Write, review, and fix Blazor Server components in the BookStore project — covering render modes (InteractiveServer), lifecycle with IDisposable cleanup, DI via @inject/[Inject], ReactiveQuery<T> for SSE-driven data loading, MudBlazor forms/dialogs/tables, tenant-aware services, and AuthorizeView guards. Trigger whenever the user writes, reviews, or asks about .razor files, adding a page or component, ReactiveQuery, MudForm/MudTable/MudDialog, real-time UI updates from SSE, tenant-aware components, optimistic updates in the frontend, authorization guards in pages, or BookStore.Web — even if they don't say "Blazor" explicitly.
633 charsno explicit “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Intermediate

Key capabilities

  • Write Blazor Server components following BookStore conventions
  • Implement reactive data loading using `ReactiveQuery<T>`
  • Manage component lifecycle with `IDisposable` cleanup
  • Integrate MudBlazor forms, dialogs, and tables
  • Authorize components using `AuthorizeView` and `[Authorize]`

How it works

It guides the creation of Blazor Server components within the BookStore project, focusing on `InteractiveServer` render mode, `IDisposable` cleanup, `ReactiveQuery<T>` for data, MudBlazor for UI, and `AuthorizeView` for authorization.

Inputs & outputs

You give it
Blazor component requirements for BookStore project
You get back
Blazor Server component (`.razor` file) adhering to BookStore conventions

When to use blazor

  • Implement reactive data loading
  • Add MudBlazor forms or tables
  • Manage IDisposable cleanup
  • Authorize components via AuthorizeView

About this skill

Blazor Components — BookStore Conventions

BookStore's Blazor Server frontend is built around a few key abstractions: ReactiveQuery<T> for reactive data fetching, BookStoreEventsService for SSE subscriptions, and MudBlazor for all UI components. Getting these patterns right avoids the most common failure modes: missing IDisposable cleanups, forgetting SSE event propagation, and bypassing the Refit client layer.

Quick Reference

TopicRead this file
Component skeleton, render mode, DI, lifecycle, IDisposablereferences/component-anatomy.md
ReactiveQuery<T>, SSE subscriptions, loading states, optimistic updatesreferences/reactive-query.md
MudForm, MudTable (server-side), dialogs, ETags, search debouncereferences/forms-dialogs.md
AuthorizeView, [Authorize], TenantService, tenant-aware componentsreferences/auth-tenant.md
Common mistakes and anti-patternsreferences/pitfalls.md

Related skills: ../bunit/SKILL.md (testing Blazor components), ../aspnet-sse/SKILL.md (SSE backend implementation), ../aspnet-hybrid-cache/SKILL.md (cache invalidation wiring).

Canonical Page Skeleton

This is the shape every stateful, data-loading page follows. Read references/component-anatomy.md for variants and explanation.

@page "/admin/widgets"
@rendermode InteractiveServer
@implements IDisposable

@inject IWidgetsClient WidgetsClient
@inject BookStoreEventsService EventsService
@inject QueryInvalidationService InvalidationService
@inject ISnackbar Snackbar

<PageTitle>Widgets</PageTitle>

@if (_query?.IsLoading == true && _query.Data == null)
{
    <MudSkeleton />
}
else if (_query?.IsError == true)
{
    <MudAlert Severity="Severity.Error">@_query.Error</MudAlert>
}
else
{
    @* render _query.Data *@
}

@code {
    [Inject] private ILogger<Widgets> Logger { get; set; } = default!;

    private ReactiveQuery<IReadOnlyList<WidgetDto>>? _query;
    private readonly CancellationTokenSource _cts = new();
    private bool _disposed;

    protected override async Task OnInitializedAsync()
    {
        EventsService.StartListening();
        EventsService.OnNotificationReceived += HandleNotification;

        _query = new ReactiveQuery<IReadOnlyList<WidgetDto>>(
            queryFn:             ct => WidgetsClient.GetWidgetsAsync(ct),
            eventsService:       EventsService,
            invalidationService: InvalidationService,
            queryKeys:           ["Widgets"],
            onStateChanged:      () => InvokeAsync(StateHasChanged),
            logger:              Logger);

        await _query.LoadAsync(cancellationToken: _cts.Token);
    }

    private async void HandleNotification(IDomainEventNotification notification)
    {
        if (notification is PingNotification) return;
        if (InvalidationService.ShouldInvalidate(notification, ["Widgets"]))
            await InvokeAsync(async () => { await _query!.LoadAsync(silent: true, _cts.Token); });
    }

    public void Dispose()
    {
        if (_disposed) return;
        _disposed = true;
        _cts.Cancel();
        _cts.Dispose();
        _query?.Dispose();
        EventsService.OnNotificationReceived -= HandleNotification;
    }
}

Rules at a Glance

  • All stateful pages declare @rendermode InteractiveServer; dialogs/shared components inherit it
  • Every SSE subscriber must @implements IDisposable and unsubscribe in Dispose()
  • Data loading uses ReactiveQuery<T> — never raw await Client.GetAsync() in OnInitializedAsync without reactive wrapping
  • Always use injected Refit clients (IBookStoreClient interfaces) — never raw HttpClient
  • New query keys (e.g., "Widgets") must be registered in QueryInvalidationService to receive SSE-driven invalidation
  • UI mutations go through CatalogService/AdminService for optimistic update orchestration; write results directly in the page only for simple admin flows
  • Forms use MudBlazor's MudForm/MudTextField — not EditContext/DataAnnotations

Common Mistakes

See references/pitfalls.md for detailed before/after code. Quick list:

  • Missing IDisposable → SSE events still fire after navigation, causing exceptions on disposed components
  • Missing QueryInvalidationService mapping → SSE arrives but UI never refreshes
  • Calling StateHasChanged() from a non-Blazor thread → use InvokeAsync(StateHasChanged) inside HandleNotification
  • Calling HttpClient directly → bypasses TenantHeaderHandler and auth chain; always use Refit interfaces
  • Business logic in .razor → move to Services/ or backing classes
  • async void event handler without try/catch → unhandled exceptions crash the circuit; add error handling or use InvokeAsync<Task>

When not to use it

  • When working on Blazor WebAssembly projects
  • When the project does not follow BookStore's specific Blazor conventions
  • When using a different UI framework than MudBlazor

Limitations

  • It is specific to the BookStore project's Blazor architecture.
  • It focuses on Blazor Server components.
  • It relies on MudBlazor for UI components.

How it compares

This skill provides specific architectural patterns and conventions for Blazor Server components within the BookStore project, including reactive data fetching and MudBlazor integration, rather than general Blazor development.

Compared to similar skills

blazor side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
blazor (this skill)04moNo flagsIntermediate
component-development14moReviewIntermediate
avalonia-viewmodels-zafiro06moNo flagsIntermediate
syncfusion-blazor-toolkit-calendars01moNo flagsBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

aspnet-sse

aalmada

Implement Server-Sent Events (SSE) in ASP.NET Core using TypedResults.ServerSentEvents, SseItem<T>, and Channel-based pub/sub — including the notification service pattern, multi-instance Redis scaling, and the SseParser client. Trigger whenever the user writes, reviews, or asks about SSE, real-time

00

etag

aalmada

Use this skill for any request involving HTTP ETags, conditional requests, or optimistic concurrency in REST APIs: implementing/explaining ETag headers, preventing lost updates, designing cache validation or conditional GET/PUT/DELETE, explaining If-Match, If-None-Match, 304 Not Modified, or 412 Pre

00

tunit

aalmada

Use this skill to write, review, and fix TUnit tests in .NET projects: for new test classes, assertions, data-driven tests, lifecycle hooks, debugging, migrating from xUnit/NUnit, choosing assertions, using Bogus, NSubstitute mocks, integration tests, or questions about parallelism and test ordering

00

bogus

aalmada

Generate realistic fake data for .NET projects using the Bogus library. Use for test data, database seeding, randomized object creation, and prototyping. Always prefer Bogus over hand-rolled random data or hardcoded test values. Trigger for any .NET test, data seeding, or sample data scenario. Use t

00

bunit

aalmada

Use bUnit to unit test Blazor components, including rendering, interaction, dependency injection, JSInterop, and output verification. Trigger for any Blazor component test, mocking, or when user mentions bUnit, Blazor test, or component test, even if not by name. Prefer this skill over hand-rolled t

00

refit

aalmada

Use Refit to define type-safe REST clients in .NET as C# interfaces backed by HttpClient — covering interface definition (HTTP verb attributes, parameter binding, return types), DI registration with AddRefitClient, DelegatingHandler pipelines for auth/headers/logging, error handling with IApiRespons

00

Search skills

Search the agent skills registry