clean-arch-domain
Skill10 starsChanged 8 days agoMITView on GitHub
Decide whether a business rule belongs in the domain (entities) or in a use case (interactor) under Clean Architecture. Use when designing or reviewing where logic lives, splitting requirements (use cases or user stories) into code, or when the user runs /clean-arch-domain. For general design quality use design-principles; for writing the use cases or stories use user-stories.
In this repository35 other files it gives its agents.
- AGENTS.mdAGENTS.md
- design-principlesSkill
- experimentationSkill
- groupingSkill
- idea-qualitySkill
- info-foragingSkill
- investingSkill
- listeningSkill
- misfitsSkill
- motivationSkill
- needs-to-signalsSkill
- optionalitySkill
- perspectiveSkill
- purposeSkill
- testingSkill
- verify-before-shipSkill
- resume-deep-diveSkill
- review-resumeSkill
- inspiring-ideaSkill
- next-goalSkill
- side-quest-recommendSkill
- still-want-itSkill
- find-the-argumentSkill
- make-presentation-slideSkill
- agent-evalsSkill
- behavior-viewSkill
- black-boxSkill
- mutation-testingSkill
- structure-viewSkill
- test-oracleSkill
- unit-testsSkill
- user-storiesSkill
- white-boxSkill
- negotiationSkill
- readableSkill
The file
Files
/clean-arch-domain
Decide where each business rule lives: domain or use case. Use everything below to do the work or to review it; in a review, name each breach once, with the move that fixes it: the rule moved to its one home, or the dependency turned to point inward. Mark a definition that does not apply as not applicable.
Core principles
- Two kinds of business rules. Application-independent rules would hold in any application the business uses, even if it has only one, and live in entities (the domain). Application-specific rules exist only for this application's process and live in use cases. Each application has its own use cases, even when two applications do similar things; only entities are shared between applications. Each rule has one home; a rule stated in more than one place is a violation. In any field, the domain is that field's own application-independent rules; these principles are how to sort them, not the domain itself.
- Dependencies point inward. Source-code dependencies point from the outer side toward the business rules. The outer side is the delivery mechanism (whatever talks to users or other systems), storage, frameworks and tools. Nothing inside (domain and use cases) depends on it, and no business rule sits in it. A rule that a tool carries out today is still a business rule and stays inside; only how the tool carries it out is outer detail. For every outer service the business rules need, they own an interface and the outer side implements it; for storage this is the entity gateway.
- Architecture reveals intent. The structure shows the use cases, not the tools.
- Business rules are testable on their own. Each use case can be tested by passing a request model in and reading the response model out, with only the interactor and its entities running: no delivery mechanism, no storage.
Definitions
Use case
A use case gives the input data (named, not structured), the primary course (the steps when everything goes right), and the exception courses (the steps when something goes wrong). Each step says what the system does, never how: validation criteria are decided later. It names no delivery mechanism or storage. The actor's action that starts it is not a system step. A user story and a use case are the same thing. Keep use cases light: plain text with the input data, primary course and exception courses. A use case is not heavy by nature; the heaviness came from elaborate forms laid on top of it.
Entity
An entity is a business object holding application-independent rules, not just data, so many use cases and applications may use it. It is not a copy of one storage table: it typically spans several tables and can carry its own operations.
Interactor
A use case takes data in, processes it, and puts data out, so it can become an object: the interactor (Jacobson's control object). It carries out the application-specific rules and directs several entities.
Boundaries
Data enters and leaves an interactor through boundaries (abstract interfaces). The interactor implements the input boundary; the delivery mechanism implements the output boundary, so the interactor does not depend on what shows its results.
- Request model: the delivery mechanism translates its input into it and passes it through the input boundary, so the interactor never sees the input in the form it had on the outer side. It holds plain values only and depends on no framework.
- Response model: the interactor gathers its results into it as unformatted values and passes it out through the output boundary; the delivery mechanism formats them.
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.

