← Back to list

scaffold-frontend-feature
by aalmada
Full-stack .NET online book store application with event-sourced backend API and Blazor frontend, orchestrated by Aspire.
⭐ 13🍴 0📅 Jan 24, 2026
SKILL.md
name: scaffold-frontend-feature description: Adds a new feature to the Web Frontend (Blazor) with Reactive State, Optimistic Updates, and Cache Invalidation. Use this when implementing user-facing features that need real-time updates.
Follow this guide to implement a responsive frontend feature in src/Web/BookStore.Web.
-
Prerequisites
- Ensure the API Client exists:
src/Client/BookStore.Client/I{Resource}Client.cs. - Ensure the Shared/Response DTOs exist in
BookStore.Shared. - if NOT, run
/scaffold-reador/scaffold-writefirst.
- Ensure the API Client exists:
-
Create the Component
- Create/Update
src/Web/BookStore.Web/Components/Pages/{Feature}.razor. - Template:
templates/Page.razor - Lifecycle: Use
OnInitializedAsyncto start listening:EventsService.StartListening();.
- Create/Update
-
Implement Data Fetching
- Pattern: Use
ReactiveQuery<T>. - Setup (Template):
templates/ReactiveQueryInit.cs
- Pattern: Use
-
Implement Optimistic Updates (Properties)
- Use Case: Toggling a boolean, changing a number (e.g., Favorites).
- Pattern:
Mutate -> Call -> Rollback.query.MutateData(s => s with { IsFavorite = true }); // 1. Instant UI update try { await Client.UpdateAsync(); // 2. API Call } catch { query.MutateData(s => s with { IsFavorite = false }); // 3. Revert on error }
-
Implement Optimistic Updates (Lists)
- Use Case: Adding a new item to a list instantly.
- Pattern:
OptimisticService.AddOptimisticBook(id, title); // 1. Add to separate list await Client.CreateAsync(); // 2. API Call (Event will confirm/remove it) - UI: Merge
query.DatawithOptimisticService.GetOptimisticBooks()when rendering lists.
-
Configure Invalidation
- Open
src/Web/BookStore.Web/Services/QueryInvalidationService.cs. - Add cases to
GetInvalidationKeys(IDomainEventNotification notification). - Rule: Map the Domain Event (e.g.,
BookCreated) to the Query Keys you defined in Step 2 (e.g.,"Books").
- Open
-
Verify
- Run the app and verify:
- Data loads.
- Mutations update UI instantly.
- SSE events (from other tabs/users) trigger auto-refetch.
- Run
/verify-featurefor complete verification.
- Run the app and verify:
Related Skills
Prerequisites:
- Backend endpoints must exist first:
/scaffold-write- For mutation endpoints/scaffold-read- For query endpoints
- Client SDK must be configured (usually done by scaffold-write/read)
Next Steps:
/scaffold-test- Create integration tests for the feature/verify-feature- Complete verification
Debugging:
/debug-sse- If real-time updates don't work/debug-cache- If query data is stale
See Also:
- real-time-notifications - SSE architecture
- scaffold-write - Backend mutations
- scaffold-read - Backend queries
- Web AGENTS.md - ReactiveQuery patterns and SSE integration
Score
Total Score
75/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
✓説明文
100文字以上の説明がある
+10
○人気
GitHub Stars 100以上
0/15
✓最近の活動
1ヶ月以内に更新
+10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
✓タグ
1つ以上のタグが設定されている
+5
Reviews
💬
Reviews coming soon

