clean-architecture
Skill3 starsChanged 8 months agoCC0-1.0View on GitHub
Enforces Clean Architecture principles including the dependency rule, layer separation, and component design. Use when structuring application layers, defining boundaries between domain and infrastructure, reviewing code for dependency rule violations, applying Screaming Architecture, or evaluating component cohesion and coupling (REP, CCP, CRP, ADP, SDP, SAP).
28 other projects use a version of this.
Adopted by
Most recently taken up by
- kinhluan/skillstheir own version, first seen Nov 8, 2026
- codewithmukesh/dotnet-claude-kittheir own version, first seen Nov 8, 2026
- yht-4403/jc-agent-skillstheir own version, first seen Nov 8, 2026
- zdanovichnick/dotnet-pilottheir own version, first seen Nov 6, 2026
- nledford/engineering-review-boardtheir own version, first seen Nov 3, 2026
- soysantana/skillstheir own version, first seen Nov 1, 2026
Used with
Projects with it also use convention-learner, opentelemetry and 7 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
codewithmukeshSkillconvention-learner
Detects and enforces project-specific coding conventions by analyzing existing codebase patterns. Learns naming conventions, folder structure, test organization, and coding style from the existing code. Load when: "conventions", "coding standards", "project patterns", "enforce style", "detect patterns", "learn conventions", "code consistency".
Also in 3 projects that use this
codewithmukeshSkillopentelemetry
OpenTelemetry observability for .NET 10 applications. Covers traces, metrics, and logs using the OpenTelemetry SDK with OTLP export. Includes custom ActivitySource, IMeterFactory metrics, resource configuration, and Aspire Dashboard integration. Load this skill when setting up distributed tracing, custom metrics, OTLP export, or when the user mentions "OpenTelemetry", "OTLP", "traces", "spans", "Activity", "ActivitySource", "metrics", "IMeterFactory", "Meter", "Counter", "Histogram", "Gauge", "telemetry", "observability", "distributed tracing", "OTEL", or "Aspire Dashboard".
Also in 3 projects that use this
MovGP0Skillmodern-csharp
Modern C# style guidance for Bendex and MicroSea code changes, including primary constructors, expression-bodied members, var usage, target-typed new, lambdas, and pattern matching.
Also in 3 projects that use this
MicrosoftSkillresilience
Apply resilience patterns (retry, backoff, circuit breaking) when writing or reviewing code that makes outbound HTTP/REST calls, database operations, or any I/O that can experience transient failures. Use this skill when: (1) writing new code that calls external services or APIs, (2) reviewing code that uses fetch, HTTP clients, or service-to-service calls, (3) adding queue consumers or workers that interact with remote systems, (4) debugging intermittent failures in production.
Also in 3 projects that use this
hongyuancSkillvertical-slice
Build and evaluate a production-quality vertical slice before advancing from Pre-Production to Production.
Also in 3 projects that use this
wpankSkillcaching
Caching strategies, invalidation, eviction policies, HTTP caching, distributed caching, and anti-patterns. Use when designing cache layers, choosing eviction policies, debugging stale data, or optimizing read-heavy workloads.
Also in 3 projects that use this
Other versions28 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 28
- ciembor/agent-rules-books★ 2.8ksame name
- wondelai/skills★ 2.6ksame name
- codewithmukesh/dotnet-claude-kit★ 808same name
- Mindrally/skills★ 275same name
- Resgrid/Core★ 238same name
- GabrielMartinMoran/mind★ 193same name
- tokenaissance/clean-architecture★ 17same name
- G1Joshi/Agent-Skills★ 15same name
- korallis/skills-collection★ 14same name
- nledford/engineering-review-board★ 11same name
18 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository48 other files it gives its agents.
- 3d-printingSkill
- app-securitySkill
- architecture-designSkill
- aws-genai-lensSkill
- aws-well-architected-frameworkSkill
- aws-well-architectedSkill
- azure-well-architectedSkill
- blog-post-with-diagramsSkill
- clean-codeSkill
- databricks-genie-spaces-best-practicesSkill
- data-visualization-guideSkill
- design-an-interfaceSkill
- design-patternsSkill
- domain-driven-designSkill
- dry-principleSkill
- edit-articleSkill
- event-driven-designSkill
- git-best-practicesSkill
- git-guardrails-claude-codeSkill
- grill-meSkill
- hexagonal-architectureSkill
- improve-codebase-architectureSkill
- language-conventions-source-en-docs-brSkill
- learn-electronicsSkill
- linked-dataSkill
- microservices-skillSkill
- object-oriented-programmingSkill
- oop-design-patternsSkill
- oreilly-design-referenceSkill
- organize-docs-from-zipSkill
- prd-to-issuesSkill
- prd-to-planSkill
- project-context-syncSkill
- request-refactor-planSkill
- rfc2119Skill
- scaffold-exercisesSkill
- semverSkill
- setup-pre-commitSkill
- solid-principlesSkill
- tddSkill
- todoSkill
- triage-issueSkill
- ts-otp-awsSkill
- ubiquitous-languageSkill
- ux-design-principlesSkill
- write-a-prdSkill
- write-a-skillSkill
- yagni-principleSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
19 rules. 0 are common, 18 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 26 edited versions we read keep these.
18
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 37
MUST NOT depend on any other layer
- Distinctive: line 38
MUST NOT import framework classes, database libraries, or HTTP concepts
- Distinctive: line 45
MUST depend only on Entities
- Distinctive: line 46
MUST NOT know about delivery mechanism (HTTP, CLI, queue) or persistence technology
- Very specific: line 47
SHOULD be named by business action: PlaceOrder, CancelSubscription, TransferFunds
- Distinctive: line 52
MUST NOT contain business logic — only format conversion and delegation
- Distinctive: line 53
All SQL, HTTP serialization, and framework annotations are restricted to this layer
- Distinctive: line 60
SHOULD contain minimal code — mostly glue configuration wiring frameworks to adapters
- Distinctive: line 67
MUST pass only simple data structures across boundaries: DTOs, primitives, or plain value objects
- Distinctive: line 68
MUST NOT pass Entities outward — map to a response DTO at the adapter layer
- Distinctive: line 69
MUST NOT pass database rows or ORM entities inward — map to domain objects at the adapter layer
- Distinctive: line 70
SHOULD NOT create identical DTOs for every layer boundary — map only where formats genuinely differ
- Distinctive: line 102
SHOULD organize top-level packages by business capability or use case
- Distinctive: line 118
SHOULD push all logic out of hard-to-test components into their testable counterparts
- Distinctive: line 119
SHOULD use the humble object boundary as a natural seam for unit vs integration testing
- Distinctive: line 133
SHOULD balance these three forces: REP and CCP tend to make components larger.
- Distinctive: line 143
MUST break dependency cycles using DIP (introduce an interface) or extract a new shared component
- Distinctive: line 144
SHOULD measure instability (I = outgoing / (incoming + outgoing)) and abstractness (A = abstract classes / total classes)
- Distinctive: line 164
When designing or reviewing architecture, verify:
“Common” is measured: kept by at least 6 in 10 of the 26 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Clean Architecture
Reference: Clean Architecture (Martin), Get Your Hands Dirty on Clean Architecture (Hombergs), Fundamentals of Software Architecture (Richards & Ford)
When to Apply
- Structuring a new application's package/module layout
- Defining boundaries between domain logic and infrastructure
- Reviewing imports for dependency rule violations
- Deciding how data should cross layer boundaries
- Evaluating whether the architecture "screams" business purpose or framework choice
- Assessing component cohesion and coupling in a modular system
The Dependency Rule
The overriding rule: Source code dependencies MUST only point inward — from outer layers toward inner layers. Nothing in an inner circle can know anything about an outer circle: no names, no data formats, no function calls.
Dynamic polymorphism (DIP) creates source code dependencies that oppose the flow of control, allowing inner layers to define interfaces that outer layers implement.
The Four Layers
From innermost (most stable) to outermost (most volatile):
1. Entities (Enterprise Business Rules)
- Domain objects encapsulating business rules independent of any application
- Least likely to change when externalities change
- MUST NOT depend on any other layer
- MUST NOT import framework classes, database libraries, or HTTP concepts
- Examples:
Order,Money,ShippingPolicy
2. Use Cases (Application Business Rules)
- Application-specific orchestration — direct entities to use their business rules
- Each use case represents one user goal or system operation
- MUST depend only on Entities
- MUST NOT know about delivery mechanism (HTTP, CLI, queue) or persistence technology
- SHOULD be named by business action:
PlaceOrder,CancelSubscription,TransferFunds
3. Interface Adapters
- Controllers, presenters, gateways — convert data between use case format and external format
- MUST NOT contain business logic — only format conversion and delegation
- All SQL, HTTP serialization, and framework annotations are restricted to this layer
- Examples: REST controllers, repository implementations, view models, DTO mappers
4. Frameworks & Drivers
- Outermost layer: web frameworks, databases, UI, external services
- "The web is a detail. The database is a detail."
- SHOULD contain minimal code — mostly glue configuration wiring frameworks to adapters
- Changes here MUST NOT propagate inward
Data Crossing Boundaries
- MUST pass only simple data structures across boundaries: DTOs, primitives, or plain value objects
- MUST NOT pass Entities outward — map to a response DTO at the adapter layer
- MUST NOT pass database rows or ORM entities inward — map to domain objects at the adapter layer
- SHOULD NOT create identical DTOs for every layer boundary — map only where formats genuinely differ
| Direction | What Crosses | Example |
| Inward (request) | Input DTO or command object | PlaceOrderCommand { customerId, items[] } |
| Outward (response) | Output DTO or result object | OrderConfirmation { orderId, estimatedDelivery } |
| Never | Entity, DB row, ORM model, framework object | Order entity, Hibernate proxy, Express Request |
Screaming Architecture
The top-level directory structure SHOULD reveal the system's business purpose, not its framework.
Good — screams "health clinic":
src/
appointments/
patients/
billing/
prescriptions/Bad — screams "Spring Boot":
src/
controllers/
services/
repositories/
models/- SHOULD organize top-level packages by business capability or use case
- MAY use technical sub-packages within a business package (e.g.,
appointments/adapter/,appointments/domain/)
Humble Object Pattern
Split behavior into two parts: a testable component with all the logic, and a humble component that is hard to test but contains minimal logic.
| Component | Testable? | Contains |
| Presenter | Yes | Formats data, applies display logic, builds view model |
| View | Humble (hard to test) | Renders the view model to screen — minimal logic |
| Gateway | Yes (interface) | Defines data access contract |
| Repository Impl | Humble | Executes SQL, calls ORM — tested via integration tests |
- SHOULD push all logic out of hard-to-test components into their testable counterparts
- SHOULD use the humble object boundary as a natural seam for unit vs integration testing
Component Design Principles
Cohesion Principles (what goes inside a component)
| Principle | Rule | Tension |
| REP (Reuse/Release Equivalence) | The granule of reuse is the granule of release — group things released together | Too broad: components become bloated |
| CCP (Common Closure) | Classes that change together belong together — SRP at component level | Too narrow: too many components |
| CRP (Common Reuse) | Don't force users to depend on things they don't need — ISP at component level | Too strict: components fragment |
SHOULD balance these three forces: REP and CCP tend to make components larger; CRP makes them smaller. Early in development, favor CCP (group by change). As the system matures, shift toward CRP (minimize unnecessary dependencies).
Coupling Principles (relationships between components)
| Principle | Rule |
| ADP (Acyclic Dependencies) | The component dependency graph MUST have no cycles |
| SDP (Stable Dependencies) | Depend in the direction of stability — volatile components depend on stable ones |
| SAP (Stable Abstractions) | Stable components SHOULD be abstract; unstable components SHOULD be concrete |
- MUST break dependency cycles using DIP (introduce an interface) or extract a new shared component
- SHOULD measure instability (I = outgoing / (incoming + outgoing)) and abstractness (A = abstract classes / total classes)
- Components in the "zone of pain" (stable + concrete) are rigid; components in the "zone of uselessness" (unstable + abstract) are irrelevant
Common Pitfalls
| Pitfall | Why It Happens | Remedy |
| Over-layering CRUD apps | Applying 4 layers to simple data entry | Skip use case layer for trivial operations; use adapters directly |
| Use cases as repository proxies | Use case does nothing but call repository.save() | If there's no business logic, the use case adds no value — simplify |
| Mapping everything | Identical DTOs at every boundary | Map only where formats genuinely differ; don't cargo-cult mapping |
| "Easy database swap" myth | Justifying layers by hypothetical DB migration | Layers exist for testability and independence, not DB swaps |
| Framework in the domain | Annotations, framework types leak into entities | Entities MUST be plain objects with zero framework dependencies |
| Designing components top-down | Trying to define all components before writing code | Component structure evolves as the codebase grows — don't over-plan |
Checklist
When designing or reviewing architecture, verify:
- Source code dependencies point inward — no inner layer imports from an outer layer
- Entities contain business rules and have zero framework dependencies
- Use cases orchestrate entities without knowing about HTTP, SQL, or UI
- Interface adapters convert between use case format and external format only
- Data crosses boundaries as DTOs or simple structures, never as entities or DB rows
- Top-level directory structure reveals business purpose (Screaming Architecture)
- Hard-to-test code is isolated in humble objects with minimal logic
- Component dependency graph has no cycles (ADP)
- Stable components are abstract; volatile components are concrete (SAP)
- Architecture complexity matches the problem — no over-layering for simple operations
Key References
| Book | Author(s) | Publisher | Year |
| Clean Architecture | Robert C. Martin | Pearson | 2017 |
| Get Your Hands Dirty on Clean Architecture (2nd ed.) | Tom Hombergs | Packt | 2023 |
| Fundamentals of Software Architecture | Mark Richards, Neal Ford | O'Reilly | 2020 |
| Software Architecture: The Hard Parts | Ford, Richards, Sadalage, Dehghani | O'Reilly | 2021 |
| Software Architecture in Practice (4th ed.) | Bass, Clements, Kazman | Addison-Wesley | 2024 |
| A Philosophy of Software Design (2nd ed.) | John Ousterhout | Stanford | 2021 |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

