clean-architecture
Skill1 starsChanged 3 months agoMITView on GitHub
How to place and wire code under this project's clean-architecture layers — which layer a file belongs to, reaching the outside through a port, wiring adapters, and what to do when the architecture check fails. Use for any change that adds a file, an import between modules, or a dependency on a framework, database or external service. Trigger on "layers", "clean architecture", "hexagonal", "ports and adapters", "dependency rule", "use case", "repository", "architecture check failed", "where does this go".
16 other projects use a version of this.
Adopted by
Most recently taken up by
- novatic-cu/nova-skillstheir own version, first seen Sep 20, 2026
- zaffnet/whetstonetheir own version, first seen Sep 17, 2026
- ciembor/agent-rules-bookstheir own version, first seen Sep 9, 2026
- korallis/skills-collectiontheir own version, first seen Aug 28, 2026
- tokenaissance/clean-architecturetheir own version, first seen Aug 9, 2026
- omaromar9091/clean-architecture-skilltheir own version, first seen Jul 27, 2026
Used with
Projects with it also use domain-driven-design and tdd.
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.
jarrodmedranoSkilldomain-driven-design
This skill should be used whenever domain modeling is taking place. It provides specialized guidance for type-driven and data-driven design based on Rich Hickey and Scott Wlaschin's principles. The skill helps contextualize current modeling within the existing domain model, identifies inconsistencies, builds ubiquitous language, and creates visualizations (Mermaid, Graphviz/DOT, ASCII diagrams) to communicate domain concepts clearly. Use this skill when designing types, modeling business domains, refactoring domain logic, or ensuring domain consistency across a codebase.
Also in 4 projects that use this
AWSSkilltdd
Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
Also in 3 projects that use this
Other versions16 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 16
- ciembor/agent-rules-books★ 2.9ksame name
- wondelai/skills★ 2.3ksame name
- codewithmukesh/dotnet-claude-kit★ 750same name
- Mindrally/skills★ 266same name
- krzysztofsurdy/code-virtuoso★ 22same name
- korallis/skills-collection★ 18same name
- tokenaissance/clean-architecture★ 17same name
- joabgonzalez/ai-agents-skills★ 9same name
- roanbrasil/engineer-grade-agent-skills★ 8same name
- qiuzhiaho1149-prog/fugue★ 4same name
6 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 repository18 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- adversarial-reviewSkill
- decision-recordingSkill
- design-system-checkSkill
- feature-branchingSkill
- finding-dispositionSkill
- git-recoverySkill
- gotcha-recordingSkill
- human-checkpointSkill
- plan-reviewSkill
- plan-writingSkill
- pr-createSkill
- spec-writingSkill
- tdd-loopSkill
- update-toolkitSkill
- wiki-updateSkill
- worker-dispatchSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 15 edited versions we read keep these.
4
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 25
Put it in the directory the layer table names.
- Distinctive: line 29
When application or domain code needs the outside world (persistence, time, randomness, email, another service):
- Distinctive: line 34
Wire it in the composition root: only. Nothing else constructs a concrete adapter — a use case receives its ports.
- Very specific: line 36
Never import a framework type, ORM model, HTTP request/response or SDK object into domain or application, not even "just the type".
- Distinctive: line 53
Mocking what you own in domain tests: instead of writing a fake of the port — the test then asserts calls, not behavior.
“Common” is measured: kept by at least 6 in 10 of the 15 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 — placing and wiring code
Read first
docs/wiki/architecture.md § Layers— the layer table, the composition root, the exceptions. It is the contract; this skill is how to work inside it.docs/wiki/commands.md § Architecture— the check that enforces it.
Place every new file
Decide the layer before writing the file, by what the code knows about:
| If the code… | Layer |
| states a business rule and would be true with no database, UI or network | domain |
| orchestrates one user-meaningful operation (a use case) and needs something from outside | application — and it declares that need as a port |
| converts between the outside world's shapes and the application's (HTTP ↔ use-case input, rows ↔ entities, SDK ↔ port) | adapters |
| configures or wraps a framework, driver, client or runtime | infrastructure |
Put it in the directory the layer table names. A file that seems to belong to two layers is two files.
Reach the outside through a port
When application or domain code needs the outside world (persistence, time, randomness, email, another service):
- Declare the port in the application layer, named for what the use case needs (
OrderRepository.save(order),Clock.now()), in domain types — never the driver's types. - Test the use case against a fake of the port that you write in the test. Red and Green for the use case need no database.
- Implement the port in
adapters(orinfrastructurefor a thin wrapper), as its own Behavior case with an integration test against the real boundary where the project's testing strategy asks for one. - Wire it in the composition root only. Nothing else constructs a concrete adapter — a use case receives its ports.
Never import a framework type, ORM model, HTTP request/response or SDK object into domain or application, not even "just the type".
When the architecture check fails
The failure names the importing file and the forbidden target.
- Your change introduced it → move the code to the right layer, or invert the dependency with a port. Re-run the check and the tests.
- The fix is more than a small port → stop and report: which case, which import, and the port you would add.
- The rule itself looks wrong → stop and report. The rule file is protected; loosening it is a human decision recorded as an ADR.
- Never silence it: no ignore comment, no moving the import behind a dynamic load, no widening a layer's allowed list.
Anti-patterns
- Anemic use case: a use case that only forwards to a repository while the rule lives in a controller. Rules go to
domainorapplication. - Leaky port: a port returning ORM rows, HTTP responses or SDK objects.
- Service locator: reaching for a global container inside a use case instead of receiving the port.
- Shared "utils" imported by every layer that quietly imports a framework. Utilities belong to a layer too.
- Mocking what you own in domain tests instead of writing a fake of the port — the test then asserts calls, not behavior.
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.

