create-blazor-project
できること
このスキルは、新しいBlazorのWebアプリケーションを作り、そのインタラクティブのレベルを選ぶ手助けをします。新しいBlazorのサイトやアプリを始める.NETの開発者のためのものです。
使う場面
- ✓新しいBlazorのWebアプリを作りたいとき。
- ✓静的、サーバー、WebAssemblyのインタラクティブの中から選ぶ必要があるとき。
- ✓適切なオプションでプロジェクトの骨組みを作りたいとき。
スキルのリンク
https://github.com/dotnet/skills/blob/main/plugins/dotnet-blazor/skills/create-blazor-project/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“商品カタログ用の検索とカート付きの新しいBlazorのWebアプリを作ってください。最も適したシンプルなインタラクティブを使ってください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントはアプリの機能とインタラクティブのニーズを尋ね、合う最もシンプルなレンダリングのモードを選んで、対応するオプションでプロジェクトを作ります。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Create a Blazor Web App
Before You Start — Gather Requirements
If the user's request doesn't make the following clear, ask before scaffolding:
- What does the app do? List the main screens/features (e.g., "product catalog with search and shopping cart").
- What kind of interactivity is needed? Displaying data and forms? Real-time updates? Offline support? Rich drag-and-drop UI?
- Deployment environment? Internet-facing? Intranet? Mobile users on slow connections?
- Authentication needed? Anonymous? Individual accounts? Organizational (Azure AD)?
Pick the Right Interactivity Level
Blazor render modes are a progression scale. Start at the simplest level that satisfies the requirements and only move up when there's a concrete reason.
Static SSR ──→ SSR + Enhanced Nav ──→ Interactive Server ──→ Interactive WebAssembly
simplest most complex
Decision Rules
| If the app needs... | Use | Why |
|---|---|---|
| Display data, simple forms, links between pages | Static SSR (-int None) |
No JS runtime, no circuit, no WebAssembly download. Forms work via HTML POST. Enhanced navigation makes it feel snappy. |
| Everything above + a few components with client-side behavior (live search, real-time updates, complex form wizards) | Interactive Server, per-page (-int Server) |
Only the components that need interactivity opt in with @rendermode. The rest stays static. Server-side execution, full .NET access, no API layer needed. |
| Most pages need rich interactivity (dashboards, drag-and-drop, chat) | Interactive Server, global (-int Server -ai) |
Every component is interactive by default. Consistent UX, simpler mental model. Trade-off: every user holds a SignalR circuit on the server. |
| Network latency is a problem, users are on mobile/poor connections, or the app must work offline | Interactive WebAssembly (-int WebAssembly) |
Code runs in the browser. Eliminates round-trip latency but requires a .Client project, API layer for data access, and downloads the .NET runtime to the browser on first visit. For offline support, enable PWA: add a service worker and manifest after scaffolding (not included in the template by default). |
| Fast initial load (Server) + low latency after (WebAssembly) | Interactive Auto (-int Auto) |
First visit uses Server; subsequent visits use cached WebAssembly runtime. Most complex setup — see Auto constraints below. Only choose when both Server and WebAssembly constraints apply. |
Default recommendation: Start with -int Server (per-page). It covers the vast majority of apps. Upgrade to global or WebAssembly only when a specific requirement demands it.
Auto Mode Constraints
Auto mode means your component code runs on the server first, then in the browser on subsequent visits. This creates real constraints:
- All interactive components must live in the
.Clientproject — same as WebAssembly. - No direct server access from interactive components — no EF
DbContext, no file system, no server-only services. All data access must go through HTTP APIs. - Both
Program.csfiles must register matching services — the server and client DI containers must both provide implementations for any service an interactive component injects. - Code must not assume its execution environment — no
HttpContextaccess, no browser-only APIs withoutRendererInfoguards. - Test in both modes — a component that works on Server during development may break on WebAssembly in production (second visit). Test both paths.
Don'ts
- Don't pick WebAssembly "because it's cool" — it adds a
.Clientproject, forces API-mediated data access, and downloads ~10MB to the browser on first visit. - Don't pick Auto unless you can articulate why Server alone and WebAssembly alone are both insufficient.
- Don't pick global interactivity for apps where most pages are read-only content — per-page keeps the static pages fast and reduces server memory.
Scaffold the Project
Static SSR Only (display data + simple forms)
dotnet new blazor -o {AppName} -int None
No interactive runtime. Enhanced navigation enabled by default via blazor.web.js.
Interactive Server, Per-Page (recommended default)
dotnet new blazor -o {AppName} -int Server
Pages are static by default. Add @rendermode InteractiveServer to components that need interactivi
よくある質問
インタラクティブのオプションは何がありますか?
静的なサーバーのレンダリング、インタラクティブなサーバー、インタラクティブなWebAssembly、自動モードがあります。
最もシンプルなものから始めますか?
はい。最もシンプルなレベルから始め、はっきりした理由がある場合にだけ上げます。
既存のプロジェクトに機能を追加しますか?
いいえ。新しいプロジェクトを作るためのもので、既存のプロジェクトは別の場所で扱います。
詳細
作者による元の説明
Create a new ASP.NET Core web application or web site using Blazor. USE FOR: creating a new Blazor web app, scaffolding a new web project, starting a new web site, choosing render modes (Static SSR, Interactive Server, Interactive WebAssembly, Auto), running dotnet new blazor with the right options, setting up initial project structure. DO NOT USE FOR: adding features to existing projects, changing how an existing app renders, or component authoring (use author-component).
repo: dotnet/skills
人気
- GitHubのスター
- 5.8k
- ランキング
- #14565
- ライセンス
- MIT
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
create-custom-agent
5.8kVisual Studio Codeのカスタムエージェントのファイルを、独自のツール、指示、ほかのエージェントへの引き継ぎとともに作るようエージェントを支援します。
create-skill
5.8k有効な名前、明確な発動の説明、規格に従うSKILL.mdファイルを持つ、新しいエージェントのスキルを作るようエージェントを支援します。
csharp-scripts
5.8k.NETのコマンドラインツールを使って、完全なプロジェクトを作らずに、小さなC#のプログラムを一つのファイルとして実行するようエージェントを支援します。
dotnet-pinvoke
5.8k署名、文字列の扱い、メモリ、安全なハンドルを含めて、ネイティブのC言語またはC++のライブラリを.NETから正しく呼び出すようエージェントを支援します。
似ているスキル
angular-developer
280kエージェントがAngularのコードを作成し、プロジェクト構成についてアドバイスできるようにします。新しいプロジェクトの開始、コード部品の作成、パフォーマンスやアクセシビリティの改善に役立ちます。
frontend-a11y
280kエージェントが Web インターフェースを誰にとっても使いやすくするよう支援します。スクリーンリーダーやキーボード操作に対応し、サイトやアプリが適切に動作するようにします。
frontend-patterns
280kエージェントがフロントエンド開発の最新パターンを適用できるようにします。React と Next.js において、パフォーマンスの最適化、状態管理、ベストプラクティスの遵守を行います。