architecture-patterns
Implement Clean, Hexagonal (Ports & Adapters), and Domain-Driven architecture patterns
- License 许可
- MIT
- 所属仓库
- HigorAlves/orc
- 最近更新
- 2026-11-14
- Stars
- ★ 7
- Forks
- 0
01 前言 Front Matter
- name
- architecture-patterns
- description
- Implement Clean, Hexagonal (Ports & Adapters), and Domain-Driven architecture patterns
- when_to_use
- Use when designing service layers, refactoring monoliths into bounded contexts, or fixing layer dependency cycles.
02 资源文件 5
- 参考文档references/advanced-patterns.md8.1 KB
- 参考文档references/clean-architecture.md8.6 KB
- 参考文档references/ddd.md6.9 KB
- 参考文档references/dependency-rules.md4.4 KB
- 参考文档references/hexagonal.md4.5 KB
03 SKILL.md 正文
Architecture Patterns
Master proven backend architecture patterns — Clean Architecture, Hexagonal (Ports & Adapters), and Domain-Driven Design — to build maintainable, testable, scalable systems.
Given: a service boundary or module to architect. Produces: layered structure with clear dependency rules, interface definitions, and test boundaries.
When to Use This Skill
- Designing new backend services or microservices from scratch
- Refactoring monolithic applications where business logic is entangled with ORM models or HTTP concerns
- Establishing bounded contexts before splitting a system into services
- Debugging dependency cycles where infrastructure code bleeds into the domain layer
- Creating testable codebases where use-case tests do not require a running database
- Implementing DDD tactical patterns (aggregates, value objects, domain events)
Choosing a Pattern
| If you are… | Reach for | Read |
|---|---|---|
| Laying out a fresh service into layers with an inward dependency rule | Clean Architecture | references/clean-architecture.md |
| Wanting to swap infra (DB, payment gateway) without touching business logic | Hexagonal (Ports & Adapters) | references/hexagonal.md |
| Modelling a complex domain — aggregates, value objects, invariants, events | Domain-Driven Design | references/ddd.md |
| Splitting one model into multiple bounded contexts / multi-service trees | DDD strategic + ACL | references/advanced-patterns.md |
| Fighting circular imports, leaky entities, or "all logic in the controller" | Dependency rules + fixes | references/dependency-rules.md |
The three patterns are complementary, not exclusive: Clean Architecture gives the layering, Hexagonal names the boundary interfaces (ports/adapters), and DDD fills the inner layers with rich domain models. A typical service uses all three.
Reference Index
Read the relevant references/<topic>.md file on demand when you need that detail — do not load them all up front.
| Topic | File | Contents |
|---|---|---|
| Clean Architecture | references/clean-architecture.md |
Layer model, directory structure, the dependency rule, full entity → use case → repository → controller implementation, in-memory test adapters |
| Hexagonal Architecture | references/hexagonal.md |
Domain core + ports + production/test adapters, Onion vs. Clean comparison, domain services |
| Domain-Driven Design | references/ddd.md |
Strategic + tactical patterns, value objects, aggregate roots, repositories, domain events / transactional outbox, aggregate-design heuristics |
| Advanced / multi-service | references/advanced-patterns.md |
Multi-service project tree by bounded context, Anti-Corruption Layer, context map (Open Host / Shared Kernel / Conformist) |
| Dependency rules & fixes | references/dependency-rules.md |
Troubleshooting symptoms, DI container wiring, detecting & breaking dependency cycles |
Related Skills
microservices-patterns— Apply these architecture patterns when decomposing a monolith into servicescqrs-implementation— Use Clean Architecture as the structural foundation for CQRS command/query separationsaga-orchestration— Sagas require well-defined aggregate boundaries, which DDD tactical patterns provideevent-store-design— Domain events produced by aggregates feed directly into an event store
04 同仓库更多 Skills
vercel-react-best-practices
React and Next.js performance optimization guidelines from Vercel Engineering
writing-plans
Write a comprehensive implementation plan of bite-sized TDD tasks that an engineer with zero codebase context could execute — exact files, code, tests, and verification steps
writing-for-agents
orc's doctrine layer for writing any document an agent consumes — skills, AGENTS.md/CLAUDE.md, reference docs
workspace-mode
Use when cwd is a parent dir holding multiple sibling git repos — defines repo auto-detection, --repos/--repo/--all-repos/--this-repo precedence, per-repo dispatch, and linked-PR mechanics.
wizard
Generate an interactive bash wizard walking a human through work only they can perform — credentials, secrets, one-off migrations
wait-what
Stop and re-pitch — the last message did not land; say it again simply, in the project's own vocabulary.