本文へ移動
cccskills
無料GitHub で公開

cqrs-guidelines

Load for native CQS commands, queries, immutable request/result contracts, handlers (ICommandHandler, IQueryHandler), validators, cache invalidation, idempotency, or specification-driven reads in Explore.Application; not for controller-only or repository-only edits.

インストール方法を見る

含まれるファイル(7)

  • SKILL.md4.2 KB
  • resources/api-endpoint-design.md4.1 KB
  • resources/command-patterns.md527 B
  • resources/complete-examples.md3.2 KB
  • resources/handler-patterns.md805 B
  • resources/query-patterns.md424 B
  • resources/validation-integration.md464 B

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

<!-- ABOUTME: CQS guidance for commands, queries, handlers, validators, caching, and specification usage. --> <!-- ABOUTME: Keeps Explore.Application handlers thin, entity-first, cancellation-aware, and aligned with repository and response contracts. -->

Resources

  • Record contracts — load for request/result record selection, factories, collection ownership, and trusted authority.
  • Architecture — load for Application boundaries and CQS flow.
  • API — load when result mapping or the public HTTP contract changes.
  • Quick reference — load for repository-wide CQS invariants.

Rules

  • Concrete CQS requests default to sealed records. Prefer positional records only for short stable contracts; use nominal init/required members for long, optional, attributed, or presence-sensitive contracts.
  • A request carries client intent, not current authority. HTTP or trusted adapters supply current tenant/user facts from principal, route, or tenant context; body identifiers name only independently authorized targets.
  • BaseCommandResponse<TKey> and concrete payload results are immutable valid-state records. Use named success/failure factories and the shared RFC 7807 mapper; never restore public setters or contradictory constructor states.
  • Repositories return entities. Handlers perform DTO mapping and never consume ExploreDbContext or a repository-returned IQueryable.
  • Validators are manually instantiated in the handler. Cancellation flows end to end.
  • Queries may use HybridCache read-through; commands invalidate affected keys after the owning write succeeds.
  • IQuerySpecification<T> composition remains immutable and Application-owned; Persistence applies it to EF queries.
  • Pre-Agreed Seam Discipline:
    • Application Seam: Command/Query Request ICommand<TResult> / IQuery<TResult> $\rightarrow$ Immutable Result / BaseCommandResponse<TKey>.
    • API Seam: HTTP Route $\rightarrow$ RFC 7807 ProblemDetails / HAL _links / Status code.
    • Persistence Seam: IQuerySpecification<T> $\rightarrow$ Domain Aggregate Entity.
  • Zero-Internal-Mocking Invariant: Mock only external boundaries you do not control (payment gateways, external email dispatchers, clock/randomness). Never mock internal domain entities, aggregates, or CQS handlers. Use real domain entities and in-memory/test-container database fixtures.
  • SDK-Style Interfaces for External Services: External integrations must expose strongly-typed operation methods (IStripeGateway.ChargeAsync(...)) rather than generic dispatchers (IFetcher.SendAsync(...)), ensuring mocks remain simple, type-safe, and free of internal conditional branching.

Workflow

  1. Lock request construction, result-state mapping, trusted authority, and consumed equality with focused tests.
  2. Change the request/result contract and migrate all handlers, controllers, tests, and mappers in the same slice.
  3. Replace mutable result assembly with named factories and mutable request rewrites with initialization or with.
  4. Verify CQRS conventions plus the affected handler and API mapping tests.

Verification

  • dotnet test --project tests/Event.Architecture.Tests/Event.Architecture.Tests.csproj --configuration Release --verbosity quiet -- --treenode-filter "/*/*/CqrsPatternTests/*" --minimum-expected-tests 1 --no-progress --maximum-parallel-tests 1
  • dotnet test --project tests/Event.Application.UnitTests/Event.Application.UnitTests.csproj --configuration Release --verbosity quiet
  • dotnet build --configuration Release --verbosity quiet

Related

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Load for Blazor/MudBlazor UI changes involving forms, dialogs, focus, keyboard navigation, landmarks, ARIA, color contrast, RTL-safe styling, or WCAG 2.2 AA tests; not for backend-only changes.

日本語の概要は準備中です。原文の説明を表示しています。

islamu-ngo/Event82026年10月12日 更新

Load when a task asks to research, verify, compare, or look up framework/package behavior, release notes, standards, RFCs, CVEs, or unfamiliar APIs; use repository evidence first, then official docs, and not for codebase navigation alone.

日本語の概要は準備中です。原文の説明を表示しています。

islamu-ngo/Event82026年10月12日 更新

aspire

無料

Load for Aspire AppHost work: start/stop/wait resources, inspect dashboard/logs/traces, add integrations/resources, rebuild a service, run isolated worktrees, or diagnose Aspire orchestration; not for plain dotnet apps, container-only deployments, or cloud deployment.

日本語の概要は準備中です。原文の説明を表示しています。

islamu-ngo/Event82026年10月12日 更新

Load for authentication or authorization changes involving BFF cookies/tokens, JWT validation, claims/user ID extraction, policies, handler access checks, impersonation, or 401/403 bugs; not for UI affordance gating alone.

日本語の概要は準備中です。原文の説明を表示しています。

islamu-ngo/Event82026年10月12日 更新

Load for Blazor BFF server work involving YARP proxy routes, cookie sessions, access-token forwarding/refresh, downstream API calls, BFF handlers, or browser-to-API auth failures; not for client component rendering or API JWT validation alone.

日本語の概要は準備中です。原文の説明を表示しています。

islamu-ngo/Event82026年10月12日 更新

Load when editing Blazor `.razor.css`, scoped selectors, `::deep`, BEM class names, RTL/logical CSS properties, or styling nested MudBlazor components; not for global design tokens or non-Blazor CSS.

日本語の概要は準備中です。原文の説明を表示しています。

islamu-ngo/Event82026年10月12日 更新

islamu-ngo のスキルをすべて見る

このスキルの問題を報告する