跳到正文
cccskills
免费在 GitHub 公开

clean-architecture-rules

Load for cross-layer refactors, record/class or value-object migrations, new services/interfaces/repositories, project references, dependency-direction failures, or deciding whether code belongs in Domain, Application, Persistence/Infrastructure, API, or Blazor; not for a local edit wholly inside an established layer pattern.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(5)

  • SKILL.md4.1 KB
  • resources/dependency-rules.md660 B
  • resources/fix-patterns.md741 B
  • resources/layer-responsibilities.md747 B
  • resources/violation-examples.md2.8 KB

SKILL.md(原文)

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

<!-- ABOUTME: Clean Architecture dependency guardrail for Explore.Domain, Explore.Application, and layer-boundary work. --> <!-- ABOUTME: Blocks upward dependencies, misplaced validation, and layer leakage that would violate the repository contract. -->

Resources

  • Architecture — load for project/layer ownership and runtime composition.
  • Record contracts — load for record/class selection, immutable collections, semantic values, persistence leaves, or generated-client ownership.
  • Codebase structure — load when the destination project or folder is unresolved.
  • Quick reference — load for global repository invariants.

Rules

  • Domain has no external framework dependency. Entities and lifecycle objects remain classes; small self-contained values may use readonly record struct, and reference-bearing immutable value data may use sealed records.
  • Application references Domain only. Concrete native CQS requests default to sealed records, while valid-state command results use their existing named factories.
  • Persistence maps Domain entities and semantic values without making Domain depend on EF Core. Repositories return entities, never DTOs or IQueryable.
  • API and Blazor own transport, HTTP, rendering, and composition. HTTP adapters introduce trusted tenant/user authority; request bodies do not become current authority.
  • Generated browser contract shape remains generator-owned. Do not move generated records into handwritten mirrors or let generated DTO concerns flow into Domain.
  • Validators remain manually instantiated, specifications remain Application-owned, and HATEOAS policies/assemblers remain API-owned.
  • Deep Modules over Shallow Pass-Throughs: Design deep modules (large amount of behavior hidden behind a simple interface). Avoid shallow services that merely forward calls to repositories or DbSets without enforcing business invariants.
  • The Deletion Test: When evaluating an intermediate service or wrapper class, imagine deleting it. If complexity vanishes, it was an unnecessary pass-through (delete it). If complexity scatters across N callers, it was earning its keep as a deep module (preserve and deepen it).
  • Leverage and Locality:
    • Leverage: Callers gain maximum capability per method/parameter learned.
    • Locality: Invariants, state transitions, validation, and error handling concentrate in the owning domain aggregate or handler, ensuring fixes occur in one place.

Workflow

  1. Trace the contract from Domain ownership through Application, Persistence, API/OpenAPI, and generated-client consumers.
  2. Choose class, record class, or readonly record struct from identity and behavior, not from a layer-wide conversion rule.
  3. Change the innermost owning layer first, then migrate outward callers without compatibility shims.
  4. Verify dependency direction and the behavior-specific architecture ratchet.

Verification

  • dotnet test --project tests/Event.Architecture.Tests/Event.Architecture.Tests.csproj --configuration Release --verbosity quiet -- --treenode-filter "/*/*/CleanArchitectureTests/*" --minimum-expected-tests 1 --no-progress --maximum-parallel-tests 1
  • dotnet test --project tests/Event.Architecture.Tests/Event.Architecture.Tests.csproj --configuration Release --verbosity quiet -- --treenode-filter "/*/*/NamingConventionTests/*" --minimum-expected-tests 1 --no-progress --maximum-parallel-tests 1
  • 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 的全部技能

报告此技能的问题