AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified Apache-2.0 Self-run

Blazor

skill-mindrally-skills-blazor · by Mindrally

Guidelines for Blazor development including component lifecycle, state management, and performance optimization

No reviews yet
0 installs
43 views
0.0% view→install

Install

$ agentstack add skill-mindrally-skills-blazor

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-mindrally-skills-blazor)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
3mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Blazor? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Blazor Development Guidelines

You are an expert in Blazor development with deep knowledge of both Blazor Server and Blazor WebAssembly.

Component Architecture

Component Design

  • Create small, focused components
  • Use component parameters for input
  • Use EventCallback for output/events
  • Implement IDisposable for cleanup
  • Use cascading parameters sparingly

Component Structure

@page "/users/{Id:int}"
@inject IUserService UserService

@User?.Name

@code {
    [Parameter]
    public int Id { get; set; }

    private User? User { get; set; }

    protected override async Task OnInitializedAsync()
    {
        User = await UserService.GetUserAsync(Id);
    }
}

Component Lifecycle

Lifecycle Methods

  • OnInitialized/OnInitializedAsync: Initial setup
  • OnParametersSet/OnParametersSetAsync: When parameters change
  • OnAfterRender/OnAfterRenderAsync: After DOM updates
  • Dispose: Cleanup resources

Best Practices

  • Use OnInitializedAsync for data loading
  • Check firstRender in OnAfterRenderAsync
  • Dispose subscriptions and timers
  • Avoid long-running synchronous code

Data Binding

One-Way Binding

@message

Two-Way Binding

Event Handling

Click
 HandleClickWithParam(id)">Click
Async Click

Render Optimization

Prevent Unnecessary Renders

  • Use @key for list items
  • Implement ShouldRender() when appropriate
  • Use StateHasChanged() judiciously
  • Avoid inline handlers in loops

Virtualization


    
        @item.Name
    

State Management

Component State

  • Use private fields for component state
  • Call StateHasChanged() when state changes externally
  • Use InvokeAsync for thread-safe updates

Cascading Parameters


    

[CascadingParameter]
public Theme CurrentTheme { get; set; }

State Containers

  • Create injectable state services
  • Use events for state change notifications
  • Consider Fluxor for complex state management

Blazor Server vs WebAssembly

Blazor Server

  • State lives on server
  • Real-time connection via SignalR
  • Faster initial load
  • Requires stable connection
  • Better for internal apps

Blazor WebAssembly

  • Runs entirely in browser
  • Larger initial download
  • Works offline (PWA capable)
  • No server resources per user
  • Better for public apps

API Integration

HTTP Client

@inject HttpClient Http

private async Task LoadData()
{
    users = await Http.GetFromJsonAsync>("api/users");
}

Error Handling

try
{
    users = await Http.GetFromJsonAsync>("api/users");
}
catch (HttpRequestException ex)
{
    errorMessage = "Failed to load users";
}

Error Handling

Error Boundaries


    
        
    
    
        An error occurred: @ex.Message
    

Global Error Handling

  • Implement IErrorBoundary for custom handling
  • Log errors to server
  • Show user-friendly messages

Testing

bUnit Testing

[Fact]
public void ComponentRendersCorrectly()
{
    using var ctx = new TestContext();
    var cut = ctx.RenderComponent();

    cut.Find("p").MarkupMatches("Current count: 0");
    cut.Find("button").Click();
    cut.Find("p").MarkupMatches("Current count: 1");
}

Authentication

Setup

  • Use AuthenticationStateProvider
  • Use AuthorizeView for conditional UI
  • Use [Authorize] attribute on pages
  • Implement custom auth state provider for JWT

AuthorizeView


    
        Welcome, @context.User.Identity?.Name!
    
    
        Please log in.
    

Performance Tips

  • Use @key for dynamic lists
  • Implement virtualization for large lists
  • Lazy load components with @if
  • Minimize JavaScript interop calls
  • Use streaming rendering in .NET 8+

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.