Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

dotnet-blazor-patterns

БесплатноБез исполняемых скриптовНе проверен

Building Blazor apps. Hosting models, render modes, routing, streaming rendering, prerender.

wshaddixот wshaddix★ 94 звезды на GitHub

Об этом скилле

dotnet-blazor-patterns

Blazor hosting models, render modes, project setup, routing, enhanced navigation, streaming rendering, and AOT-safe patterns. Covers all five hosting models (InteractiveServer, InteractiveWebAssembly, InteractiveAuto, Static SSR, Hybrid) with trade-off analysis for each.

Scope boundary: This skill owns Blazor project setup, hosting model selection, render mode configuration, routing, enhanced navigation, streaming rendering, and AOT-safe patterns. Component architecture (lifecycle, state management, JS interop, EditForm) is owned by [skill:dotnet-blazor-components]. Authentication across hosting models is owned by [skill:dotnet-blazor-auth].

Out of scope: bUnit component testing -- see [skill:dotnet-blazor-testing]. Standalone SignalR patterns -- see [skill:dotnet-realtime-communication]. Browser-based E2E testing -- see [skill:dotnet-playwright]. UI framework selection decision tree -- see [skill:dotnet-ui-chooser].

Cross-references: [skill:dotnet-blazor-components] for component architecture, [skill:dotnet-blazor-auth] for authentication, [skill:dotnet-blazor-testing] for bUnit testing, [skill:dotnet-realtime-communication] for standalone SignalR, [skill:dotnet-playwright] for E2E testing, [skill:dotnet-ui-chooser] for framework selection, [skill:dotnet-accessibility] for accessibility patterns (ARIA, keyboard nav, screen readers).


Hosting Models & Render Modes

Blazor Web App (.NET 8+) is the default project template, replacing the separate Blazor Server and Blazor WebAssembly templates. Render modes can be set globally, per-page, or per-component.

Render Mode Overview

Render Mode Attribute Interactivity Connection Best For
Static SSR (none / default) None -- server renders HTML, no interactivity HTTP request only Content pages, SEO, forms with minimal interactivity
InteractiveServer @rendermode InteractiveServer Full SignalR circuit Low-latency interactivity, full server access, small user base
InteractiveWebAssembly @rendermode InteractiveWebAssembly Full (after download) None (runs in browser) Offline-capable, large user base, reduced server load
InteractiveAuto @rendermode InteractiveAuto Full SignalR initially, then WASM Best of both -- immediate interactivity, eventual client-side
Blazor Hybrid BlazorWebView in MAUI/WPF/WinForms Full (native) None (runs in-process) Desktop/mobile apps with web UI, native API access

Per-Mode Trade-offs

Concern Static SSR InteractiveServer InteractiveWebAssembly InteractiveAuto Hybrid
First load Fast Fast Slow (WASM download) Fast (Server first) Instant (local)
Server resources Minimal Per-user circuit None after download Circuit then none None
Offline support No No Yes Partial Yes
Full .NET API access Yes (server) Yes (server) Limited (browser sandbox) Varies by phase Yes (native)
Scalability High Limited by circuits High High (after WASM) N/A (local)
SEO Yes Prerender Prerender Prerender N/A

Setting Render Modes

Global (App.razor):

<!-- Sets default render mode for all pages -->
<Routes @rendermode="InteractiveServer" />

Per-page:

@page "/dashboard"
@rendermode InteractiveServer

<h1>Dashboard</h1>

Per-component:

<Counter @rendermode="InteractiveWebAssembly" />

Gotcha: Without an explicit render mode boundary, a child component cannot request a more interactive render mode than its parent. However, interactive islands are supported: you can place an @rendermode attribute on a component embedded in a Static SSR page to create a render mode boundary, enabling interactive children under otherwise static content.


Project Setup

Blazor Web App (Default Template)

# Creates a Blazor Web App with InteractiveServer render mode
dotnet new blazor -n MyApp

# With specific interactivity options
dotnet new blazor -n MyApp --interactivity Auto    # InteractiveAuto
dotnet new blazor -n MyApp --interactivity WebAssembly  # InteractiveWebAssembly
dotnet new blazor -n MyApp --interactivity Server  # InteractiveServer (default)
dotnet new blazor -n MyApp --interactivity None    # Static SSR only

Blazor Web App Project Structure

MyApp/
  MyApp/                     # Server project
    Program.cs               # Host builder, services, middleware
    Components/
      App.razor              # Root component (sets global render mode)
      Routes.razor           # Router component
      Layout/
        MainLayout.razor     # Main layout
      Pages/
        Home.razor            # Static SSR by default
        Counter.razor         # Can set per-page render mode
  MyApp.Client/              # Client project (only if WASM or Auto)
    Pages/
      Counter.razor           # Components that run in browser
Полный SKILL.md на GitHub

Установить dotnet-blazor-patterns в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл dotnet-blazor-patterns?

Building Blazor apps. Hosting models, render modes, routing, streaming rendering, prerender.

Как установить скилл dotnet-blazor-patterns?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл dotnet-blazor-patterns запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить dotnet-blazor-patterns с