clean-architecture by pproenca/dot-skills
npx skills add https://github.com/pproenca/dot-skills --skill clean-architecture设计可维护、可测试软件系统的整洁架构原则综合指南。基于 Robert C. Martin 的《整洁架构:软件结构与设计工匠指南》。包含 8 个类别共 42 条规则,按架构影响优先级排序。
在以下情况下参考这些准则:
| 优先级 | 类别 | 影响程度 | 前缀 |
|---|---|---|---|
| 1 | 依赖方向 | 关键 | dep- |
| 2 | 实体设计 | 关键 | entity- |
| 3 | 用例隔离 | 高 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
usecase-| 4 | 组件内聚 | 高 | comp- |
| 5 | 边界定义 | 中高 | bound- |
| 6 | 接口适配器 | 中 | adapt- |
| 7 | 框架隔离 | 中 | frame- |
| 8 | 测试架构 | 低中 | test- |
dep-inward-only - 源代码依赖仅指向内层dep-interface-ownership - 接口属于客户端而非实现者dep-no-framework-imports - 避免在内层导入框架代码dep-data-crossing-boundaries - 跨边界使用简单数据结构dep-acyclic-dependencies - 消除组件间的循环依赖dep-stable-abstractions - 依赖稳定的抽象而非易变的具体实现entity-pure-business-rules - 实体仅包含企业业务规则entity-no-persistence-awareness - 实体不得知晓其持久化方式entity-encapsulate-invariants - 在实体内部封装业务不变量entity-value-objects - 使用值对象表示领域概念entity-rich-not-anemic - 构建丰富的领域模型而非贫血的数据结构usecase-single-responsibility - 每个用例只有一个变更原因usecase-input-output-ports - 为用例定义输入和输出端口usecase-orchestrates-not-implements - 用例编排实体而非实现业务规则usecase-no-presentation-logic - 用例不得包含展示逻辑usecase-explicit-dependencies - 在构造函数中显式声明所有依赖usecase-transaction-boundary - 用例定义事务边界comp-screaming-architecture - 结构应体现领域而非框架comp-common-closure - 将一同变更的类分组comp-common-reuse - 避免强制客户端依赖未使用的代码comp-reuse-release-equivalence - 将组件作为内聚单元发布comp-stable-dependencies - 依赖方向指向稳定性bound-humble-object - 在架构边界使用谦卑对象bound-partial-boundaries - 当完全分离为时过早时使用部分边界bound-boundary-cost-awareness - 权衡边界成本与无知成本bound-main-component - 将主组件视为应用的插件bound-defer-decisions - 推迟框架和数据库决策bound-service-internal-architecture - 服务必须具有内部整洁架构adapt-controller-thin - 保持控制器精简adapt-presenter-formats - 展示器为视图格式化数据adapt-gateway-abstraction - 网关隐藏外部系统细节adapt-mapper-translation - 使用映射器在层间转换数据adapt-anti-corruption-layer - 为外部系统构建防腐层frame-domain-purity - 领域层零框架依赖frame-orm-in-infrastructure - 将 ORM 使用限制在基础设施层frame-web-in-infrastructure - Web 框架相关代码保持在接口层frame-di-container-edge - 依赖注入容器位于边缘frame-logging-abstraction - 通过领域接口抽象日志记录test-tests-are-architecture - 测试是系统架构的一部分test-testable-design - 从一开始就为可测试性设计test-layer-isolation - 隔离测试每一层test-boundary-verification - 通过测试验证架构边界阅读单独的参考文件以获取详细解释和代码示例:
| 文件 | 描述 |
|---|---|
| references/_sections.md | 类别定义和排序 |
| assets/templates/_template.md | 新规则模板 |
| metadata.json | 版本和参考信息 |
每周安装量
862
代码仓库
GitHub 星标数
86
首次出现
2026年1月24日
安全审计
安装于
opencode721
codex720
gemini-cli707
github-copilot677
kimi-cli618
amp614
Comprehensive guide to Clean Architecture principles for designing maintainable, testable software systems. Based on Robert C. Martin's "Clean Architecture: A Craftsman's Guide to Software Structure and Design." Contains 42 rules across 8 categories, prioritized by architectural impact.
Reference these guidelines when:
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Dependency Direction | CRITICAL | dep- |
| 2 | Entity Design | CRITICAL | entity- |
| 3 | Use Case Isolation | HIGH | usecase- |
| 4 | Component Cohesion | HIGH | comp- |
| 5 | Boundary Definition | MEDIUM-HIGH | bound- |
| 6 | Interface Adapters | MEDIUM | adapt- |
| 7 | Framework Isolation | MEDIUM | frame- |
| 8 | Testing Architecture | LOW-MEDIUM | test- |
dep-inward-only - Source dependencies point inward onlydep-interface-ownership - Interfaces belong to clients not implementersdep-no-framework-imports - Avoid framework imports in inner layersdep-data-crossing-boundaries - Use simple data structures across boundariesdep-acyclic-dependencies - Eliminate cyclic dependencies between componentsentity-pure-business-rules - Entities contain only enterprise business rulesentity-no-persistence-awareness - Entities must not know how they are persistedentity-encapsulate-invariants - Encapsulate business invariants within entitiesentity-value-objects - Use value objects for domain conceptsentity-rich-not-anemic - Build rich domain models not anemic data structuresusecase-single-responsibility - Each use case has one reason to changeusecase-input-output-ports - Define input and output ports for use casesusecase-orchestrates-not-implements - Use cases orchestrate entities not implement business rulesusecase-no-presentation-logic - Use cases must not contain presentation logicusecase-explicit-dependencies - Declare all dependencies explicitly in constructorcomp-screaming-architecture - Structure should scream the domain not the frameworkcomp-common-closure - Group classes that change togethercomp-common-reuse - Avoid forcing clients to depend on unused codecomp-reuse-release-equivalence - Release components as cohesive unitscomp-stable-dependencies - Depend in the direction of stabilitybound-humble-object - Use humble objects at architectural boundariesbound-partial-boundaries - Use partial boundaries when full separation is prematurebound-boundary-cost-awareness - Weigh boundary cost against ignorance costbound-main-component - Treat main as a plugin to the applicationbound-defer-decisions - Defer framework and database decisionsadapt-controller-thin - Keep controllers thinadapt-presenter-formats - Presenters format data for the viewadapt-gateway-abstraction - Gateways hide external system detailsadapt-mapper-translation - Use mappers to translate between layersadapt-anti-corruption-layer - Build anti-corruption layers for external systemsframe-domain-purity - Domain layer has zero framework dependenciesframe-orm-in-infrastructure - Keep ORM usage in infrastructure layerframe-web-in-infrastructure - Web framework concerns stay in interface layerframe-di-container-edge - Dependency injection containers live at the edgeframe-logging-abstraction - Abstract logging behind domain interfacestest-tests-are-architecture - Tests are part of the system architecturetest-testable-design - Design for testability from the starttest-layer-isolation - Test each layer in isolationtest-boundary-verification - Verify architectural boundaries with testsRead individual reference files for detailed explanations and code examples:
| File | Description |
|---|---|
| references/_sections.md | Category definitions and ordering |
| assets/templates/_template.md | Template for new rules |
| metadata.json | Version and reference information |
Weekly Installs
862
Repository
GitHub Stars
86
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode721
codex720
gemini-cli707
github-copilot677
kimi-cli618
amp614
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
103,800 周安装
dep-stable-abstractionsusecase-transaction-boundary - Use case defines the transaction boundarybound-service-internal-architecture