ワンクリックで
mock-response-factory
Add GetMockResponseFactory to API contracts and register factories in the SPA mock API service.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Add GetMockResponseFactory to API contracts and register factories in the SPA mock API service.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
How to structure Blazor app chrome with the "empty layout + cascaded page-component shell" pattern — keep LayoutComponentBase empty and put header/nav/content/aside/footer in ONE shell component that pages wrap their content in and that cascades itself. Use when designing a Blazor app's layout/navigation, deciding where chrome belongs, building a layout shell, or when chrome must react to a state store or per-navigation lifecycle that a layout can't provide.
**TIMEWARP SKILL** — product slice placement and TWA0009 isolation (SliceRoot, namespaces, platform Applications, Components/contracts sharing, CrossSliceReference opt-out). Invoke before scaffolding a new feature/slice/page or when fixing TWA0009 / cross-slice references. WHEN: "Add a new clients feature page", "Where does this state live?", "TWA0009 slice references another product slice", "CrossSliceReference", "new product area under features/", greenfield slice scaffolding.
**TIMEWARP SKILL** — endpoint-centric Web.Contracts API contracts (Command, Query, ApiRoute, I*Details, Validator, serialization tests). Invoke before scaffolding or fixing contracts. WHEN: "Add a CreateTodoItem command contract", "Scaffold a GetRole query with ApiRoute and IRoleDetails for the edit form", "Add a serialization round-trip test for my Command".
How to style Blazor + FluentUI components in this repo without Tailwind. The "isolation-first hybrid" convention — CSS isolation by default, global design tokens, and two documented exceptions for FluentUI shadow-DOM and light-DOM children. Use when authoring or restyling any .razor component, choosing where CSS lives, or styling a FluentUI component.
**WORKFLOW SKILL** — Deploy Aspire apps from AppHost models to Docker Compose, Kubernetes, Azure, or AWS. WHEN: "deploy Aspire app", "publish Aspire artifacts", "deploy to Azure Container Apps", "generate Kubernetes artifacts", "tear down Aspire deployment". INVOKES: aspire CLI, Aspire docs, target cloud/container CLIs. FOR SINGLE OPERATIONS: use generic Azure, Kubernetes, Docker, or AWS tools only when no Aspire AppHost exists.
**WORKFLOW SKILL** - First-run flow for adding Aspire to a repo. Picks `aspire new` (greenfield) or `aspire init` (existing repo), drops the AppHost skeleton, then hands off to `aspireify` for resource wiring. USE FOR: aspire init, aspire new, aspire-starter, aspire-ts-starter, aspire-py-starter, add Aspire to existing repo, scaffold Aspire app, bootstrap Aspire, no AppHost detected, install aspireify, generated .aspire/modules. DO NOT USE FOR: AppHost wiring on an existing AppHost (use aspireify), start/stop/wait (use aspire-orchestration), deploy/publish (use aspire-deployment), logs/traces (use aspire-monitoring), repo that already has an AppHost. INVOKES: aspire CLI (init, new, doctor), aspireify (handoff after skeleton drop). FOR SINGLE OPERATIONS: Run `aspire init` or `aspire new TEMPLATE` directly.
| name | mock-response-factory |
| description | Add GetMockResponseFactory to API contracts and register factories in the SPA mock API service. |
| when-to-use | GetMockResponseFactory, MockResponseFactory, MockCopicApiService, MockWebApiService, MockFactories, mock mode, IMockResponseFactory, SPA development without backend |
Enables Blazor SPA development without a live backend. Every API contract exposes a factory; the SPA mock service dispatches requests to it.
rg -l 'GetMockResponseFactory' --glob '**/*.cs' | head -5
rg -l 'Mock.*ApiService' --glob '**/*.cs'
rg 'delegate.*MockResponseFactory' --glob '**/*.cs'
Read an existing contract + its registration before adding a new one.
Add to the operation's public static partial class:
public static MockResponseFactory<Response> GetMockResponseFactory()
{
return _ => new Response(/* realistic sample data */);
}
Rules:
MockResponseFactory<TResponse> — locate in the repo's shared contracts projectdefaultListResponse<T>: several varied items, set totalCount correctlyResponse: return new Response() or the repo's established patternpublic static MockResponseFactory<Response> GetMockResponseFactory()
{
AnnouncementDto[] items =
[
new() { Text = "Maintenance tonight", Link = "/announcements/1" },
new() { Text = "New feature available", Link = "/announcements/2" },
];
return _ => new Response(totalCount: items.Length, items);
}
public static MockResponseFactory<Response> GetMockResponseFactory()
{
return _ => new Response { SecurityRoleId = 1, B2CGroupId = Guid.NewGuid() };
}
Mirror the registration pattern already in the repo. Common variants:
Dictionary on mock service:
{ typeof(GetProfile.Query), GetProfile.GetMockResponseFactory() },
{ typeof(CreateSecurityRole.Command), CreateSecurityRole.GetMockResponseFactory() },
Wrapper class per endpoint (MockFactories/ folder):
internal sealed class GetProfileMockFactory : IMockResponseFactory
{
public object Create(IApiRequest request) =>
GetProfile.GetMockResponseFactory()((GetProfile.Query)request);
}
Then register the wrapper class in the mock service's factory dictionary.
GetMockResponseFactory() on the contract partial classweb-api-contracts — full contract workflow; mock factory is step 10 of new endpoints