blazor
Skill266 starsChanged 10 months agoApache-2.0View on GitHub
Guidelines for Blazor development including component lifecycle, state management, and performance optimization
2 other projects use a version of this.
Adopted by
Most recently taken up by
- AterDev/Perigon.CLItheir own version, first seen Sep 3, 2026
- Sorcha-Platform/Sorchatheir own version, first seen Jan 24, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- AterDev/Perigon.CLI★ 54same name
- Sorcha-Platform/Sorcha★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository264 other files it gives its agents.
- accessibility-a11ySkill
- alpine-jsSkill
- analytics-data-analysisSkill
- android-developmentSkill
- angular-developmentSkill
- angularSkill
- anime-jsSkill
- anthropic-claude-developmentSkill
- api-developmentSkill
- apollo-graphqlSkill
- aspnet-coreSkill
- astroSkill
- auth0-authenticationSkill
- autogen-developmentSkill
- automl-hyperparameter-optimizationSkill
- aws-developmentSkill
- azureSkill
- backend-developmentSkill
- bash-scriptingSkill
- beautifulsoup-parsingSkill
- bitbucket-workflowSkill
- blender-python-addonSkill
- blockchainSkill
- bootstrapSkill
- business-central-developmentSkill
- cheerio-parsingSkill
- chrome-extension-developmentSkill
- ci-cd-best-practicesSkill
- clean-architectureSkill
- clean-codeSkill
- clerk-authenticationSkill
- cloudflare-developmentSkill
- computer-vision-opencvSkill
- convexSkill
- cppSkill
- c-sharpSkill
- cssSkill
- cypressSkill
- data-analysis-jupyterSkill
- data-analystSkill
- data-jupyter-pythonSkill
- deep-learning-pythonSkill
- deep-learning-pytorchSkill
- deep-learningSkill
- deno-typescriptSkill
- design-systemsSkill
- devopsSkill
- django-pythonSkill
- django-rest-api-developmentSkill
- dockerSkill
- dotnetSkill
- drizzle-ormSkill
- drupal-developmentSkill
- elasticsearch-best-practicesSkill
- electron-developmentSkill
- elixirSkill
- embedded-stm32Skill
- esbuild-bundlerSkill
- ethereumSkill
- expo-react-native-javascript-best-practicesSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
20 rules. About 0 are common, 12 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈12
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Create small, focused components
- Distinctive: line 14
Use component parameters for input
- Distinctive: line 15
Use EventCallback for output/events
- Distinctive: line 17
Use cascading parameters sparingly
- Very specific: line 48
Use OnInitializedAsync for data loading
- Very specific: line 49
Check firstRender in OnAfterRenderAsync
- Distinctive: line 51
Avoid long-running synchronous code
- Very specific: line 77
Use @key for list items
- Distinctive: line 80
Avoid inline handlers in loops
- Distinctive: line 94
Use private fields for component state
- Very specific: line 95
Call StateHasChanged() when state changes externally
- Very specific: line 96
Use InvokeAsync for thread-safe updates
- Distinctive: line 110
Create injectable state services
- Distinctive: line 111
Use events for state change notifications
- Distinctive: line 112
Consider Fluxor for complex state management
- Distinctive: line 127
No server resources per user
- Very specific: line 193
Use AuthorizeView for conditional UI
- Very specific: line 194
Use [Authorize] attribute on pages
- Very specific: line 211
Use @key for dynamic lists
- Distinctive: line 215
Use streaming rendering in .NET 8+
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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
<h1>@User?.Name</h1>
@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 setupOnParametersSet/OnParametersSetAsync: When parameters changeOnAfterRender/OnAfterRenderAsync: After DOM updatesDispose: Cleanup resources
Best Practices
- Use
OnInitializedAsyncfor data loading - Check
firstRenderinOnAfterRenderAsync - Dispose subscriptions and timers
- Avoid long-running synchronous code
Data Binding
One-Way Binding
<p>@message</p>
<input value="@inputValue" />Two-Way Binding
<input @bind="inputValue" />
<input @bind="inputValue" @bind:event="oninput" />Event Handling
<button @onclick="HandleClick">Click</button>
<button @onclick="() => HandleClickWithParam(id)">Click</button>
<button @onclick="HandleClickAsync">Async Click</button>Render Optimization
Prevent Unnecessary Renders
- Use
@keyfor list items - Implement
ShouldRender()when appropriate - Use
StateHasChanged()judiciously - Avoid inline handlers in loops
Virtualization
<Virtualize Items="@items" Context="item">
<ItemContent>
<div>@item.Name</div>
</ItemContent>
</Virtualize>State Management
Component State
- Use private fields for component state
- Call
StateHasChanged()when state changes externally - Use
InvokeAsyncfor thread-safe updates
Cascading Parameters
<CascadingValue Value="@currentTheme">
<ChildComponent />
</CascadingValue>
<!-- In child component -->
[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<List<User>>("api/users");
}Error Handling
try
{
users = await Http.GetFromJsonAsync<List<User>>("api/users");
}
catch (HttpRequestException ex)
{
errorMessage = "Failed to load users";
}Error Handling
Error Boundaries
<ErrorBoundary>
<ChildContent>
<RiskyComponent />
</ChildContent>
<ErrorContent Context="ex">
<p>An error occurred: @ex.Message</p>
</ErrorContent>
</ErrorBoundary>Global Error Handling
- Implement
IErrorBoundaryfor 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<Counter>();
cut.Find("p").MarkupMatches("<p>Current count: 0</p>");
cut.Find("button").Click();
cut.Find("p").MarkupMatches("<p>Current count: 1</p>");
}Authentication
Setup
- Use
AuthenticationStateProvider - Use
AuthorizeViewfor conditional UI - Use
[Authorize]attribute on pages - Implement custom auth state provider for JWT
AuthorizeView
<AuthorizeView>
<Authorized>
<p>Welcome, @context.User.Identity?.Name!</p>
</Authorized>
<NotAuthorized>
<p>Please log in.</p>
</NotAuthorized>
</AuthorizeView>Performance Tips
- Use
@keyfor dynamic lists - Implement virtualization for large lists
- Lazy load components with
@if - Minimize JavaScript interop calls
- Use streaming rendering in .NET 8+
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

