← Back to list

scaffold-write
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-write description: Adds a new write operation (command/mutation) to the Backend with Event Sourcing, Wolverine commands, and Projections. Use this when implementing POST, PUT, PATCH, or DELETE endpoints.
Follow this guide to implement a state-changing operation in the Backend (ApiService) using strict project standards.
-
Define the Domain Event
- Create a
recordinsrc/BookStore.ApiService/Events/. - Naming: Past tense (e.g.,
BookPublished, notPublishBook). - Timestamps: MUST use
DateTimeOffset(neverDateTime). - IDs: MUST use
Guid.CreateVersion7()(neverGuid.NewGuid()). - Example:
public record BookPublished(Guid Id, DateTimeOffset Timestamp);
- Create a
-
Define the Command
- Create a
recordinsrc/BookStore.ApiService/Commands/{Resource}/(e.g.,Commands/Books/). - Template:
templates/Command.cs
- Create a
-
Implement the Wolverine Handler
- Create/Update
src/BookStore.ApiService/Handlers/{Resource}/{Resource}Handlers.cs. - Template:
templates/Handler.cs
- Create/Update
-
Expose the Endpoint (Backend)
- Open
src/BookStore.ApiService/Endpoints/{Resource}Endpoints.cs. - Template:
templates/Endpoint.cs
- Open
-
Update Read Model (Projections)
- Open
src/BookStore.ApiService/Projections/{Resource}Projection.cs. - Implement
CreateorApplymethods.
- Open
-
Enable Real-time Updates (SSE)
- Notification: Create
record {Event}Notificationinsrc/Shared/BookStore.Shared/Notifications/DomainEventNotifications.cs. - Listener: Update
src/BookStore.ApiService/Infrastructure/MartenCommitListener.cs.- Add
case {Resource}Projection proj:inProcessDocumentChangeAsync. - Implement
Handle{Resource}ChangeAsyncto.NotifyAsync()the new notification.
- Add
- Reference: See real-time-notifications for the complete data flow.
- Notification: Create
-
Client Integration
- Interface: Create
src/Client/BookStore.Client/I{Action}{Resource}Endpoint.csmanually. - DTOs: If a Request DTO is needed, create it in
src/Shared/BookStore.Shared/Models/(do not rely on auto-generation). - Registration: Add to
BookStoreClientExtensions.cs.
- Interface: Create
// turbo 8. Verify
- Run
/verify-featureto ensure build, format, and tests pass.
Related Skills
Prerequisites:
- For complex aggregates, consider
/scaffold-aggregatefirst to create the domain model
Next Steps:
/scaffold-read- Add query endpoints for the new resource/scaffold-frontend-feature- Create UI for the new feature/scaffold-test- Create integration tests/verify-feature- Complete verification
Specialized Skills:
/scaffold-aggregate- Generate event-sourced aggregates with Apply methods/scaffold-projection- Generate read model projections for queries
See Also:
- scaffold-aggregate - Detailed aggregate patterns
- scaffold-projection - Projection creation
- wolverine-guide - Wolverine command/handler patterns
- ApiService AGENTS.md - Backend patterns and conventions
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

