blazor-component-design

Guidance for building Blazor components, which are reusable parts of a .NET web interface, in server-based or WebAssembly applications. It covers inputs, events, component lifecycle, parent-child communication, and rendering performance.

In plain words
What is it for?
Use it when creating or refactoring Blazor components, connecting component hierarchies, handling cascading values and event callbacks, or improving list and render behaviour.
Why use it?
It helps components receive data correctly, notify their parent components, update at the right time, and avoid unnecessary screen redraws. It also recommends separating complex logic from the visual markup.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/andresharpe/dotbot/blazor-component-design
Any agent
npx skills add andresharpe/dotbot --skill blazor-component-design
Clone the repo
git clone --depth 1 https://github.com/andresharpe/dotbot

Made for: Claude Code, Codex.

Per session 53 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 666 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00053 $0.00666
Opus 5 $0.00026 $0.00333
Sonnet 5 $0.00011 $0.00133
Haiku 4.5 $0.00005 $0.00067

Measured 3d ago against content hash 5251e1f41f4e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

blazor-component-design scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

content/stacks/dotnet-blazor/recipes/skills/blazor-component-design/SKILL.md · 77 lines

How it starts

The opening of the file, as written. The whole thing — 77 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Blazor Component Design

Design and implement Blazor components following project conventions.

Workflow

  1. Define component parameters — identify inputs, event callbacks, and cascading values
  2. Implement render logic — keep .razor lean, extract complex logic to code-behind
  3. Wire parent-child communication — use EventCallback<T> for upward data flow
  4. Handle lifecycle — implement OnInitializedAsync, OnParametersSetAsync as needed
  5. Optimize rendering — add @key for lists, ShouldRender() for expensive components

Component Structure

@* ItemCard.razor *@
<div class="item-card" @key="Item.Id">
    <h3>@Item.Name</h3>
    <p>@Item.Description</p>
    <button @onclick="HandleSelect">Select</button>
</div>

@code {
    [Parameter, EditorRequired]
    public ItemDto Item { get; set; } = default!;

    [Parameter]
    public EventCallback<ItemDto> OnSelected { get; set; }

    private async Task HandleSelect() => await OnSelected.InvokeAsync(Item);
}

Code-Behind Pattern

// ItemList.razor.cs
public partial class ItemList : ComponentBase, IDisposable
{
    [Inject] private IItemService ItemService { get; set; } = default!;
    [Parameter] public string? FilterCategory { get; set; }

    private List<ItemDto> _items = new();

    protected override async Task OnParametersSetAsync()
    {
        _items = await ItemService.GetItemsAsync(FilterCategory);
    }

    public void Dispose() { /* unsubscribe from events */ }
}

Best Practices

  • Parameters over cascading values — explicit data flow is easier to trace and debug
  • EventCallback<T> for parent-child communication — never mutate parent state directly
  • Code-behind for components with logic — keeps .razor focused on markup
  • @key directive on list items — prevents DOM thrashing on re-renders
  • IDisposable when subscribing to events, timers, or injected services with subscriptions
  • [EditorRequired] on mandatory parameters — catches missing bindings at compile time

Read the full file on GitHub · 77 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 77 lines · 53 tokens per session scan A 5251e1f41f4e

Subscribe to this mod's changes

blazor-component-design is a skill published in the GitHub repository andresharpe/dotbot (54 stars, last pushed 6d ago), licensed MIT. It adds 53 tokens to every session and 666 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

documentation-server

Use when you need to store, retrieve, search, or manage documents in a local knowledge base with semantic search and hybrid (vector + full-text) retrieval. Also use when interacting with the documentation server web interface, managing uploads, or performing AI-powered document analysis. Use this instead of MCP-native…

andrea9293/mcp-documentation-server · 71 tokens

gemini-skill

通过 Gemini 官网(gemini.google.com)执行生图、对话等操作。用户提到"生图/画图/绘图/nano banana/nanobanana/生成图片"等关键词时触发。操作方式分三级优先级:首选 MCP 工具 → 次选 Skill 脚本 → 最次连接 Skill 浏览器手动操作(需用户授权)。禁止自行启动外部浏览器访问 Gemini。.

WJZ-P/gemini-skill · 98 tokens

memorix

Use when Claude Code needs Memorix shared memory, reasoning, Git Memory, mini-skills, session handoff, orchestration coordination, or integration troubleshooting.

AVIDS2/memorix · 34 tokens

memorix-orchestrate

Use when a main agent needs Memorix to coordinate explicit subagent work through tasks, handoffs, messages, file locks, or the orchestrate CLI.

AVIDS2/memorix · 37 tokens

memorix-sessions

Use when resuming work, preparing handoff context, binding an HTTP control-plane project, or deciding whether sessionstart is useful.

AVIDS2/memorix · 31 tokens

video-perception

Use when the user mentions a video file (.mp4, .mov, .avi, .mkv, .webm), a YouTube URL, asks to watch/analyze/review a video, or references video content in conversation.

jordanrendric/claude-video-vision · 51 tokens