跳到正文
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(原文)

安装前可以查看交给 AI 代理的指令内容。

<!-- 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

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

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月21日 更新

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月21日 更新

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月21日 更新

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月21日 更新

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月21日 更新

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月21日 更新

查看 islamu-ngo 的全部技能

报告此技能的问题