architecture-principles
Skill0 starsChanged 4 months agoMITView on GitHub
Guides module boundaries, dependency direction, and domain structure. Do not use for local edits that leave architecture unchanged.
We split this skill into the rules it gives an agent
16 rules. 0 are common, 16 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
16
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Do not force Clean Architecture, DDD, CQRS, Event Sourcing, Hexagonal Architecture, microservices, or any other style unless:
- Distinctive: line 28
Prefer dependencies pointing toward stable business rules.
- Distinctive: line 60
When boundaries are already messy, make the change without making them worse.
- Distinctive: line 64
Use DDD where domain complexity justifies it.
- Distinctive: line 66
Prefer DDD concepts when the codebase has:
- Distinctive: line 75
Do not use DDD ceremony for simple data plumbing.
- Distinctive: line 79
Use domain language in names.
- Distinctive: line 80
Keep invariants close to the domain model.
- Distinctive: line 82
Keep application orchestration separate from domain decisions.
- Distinctive: line 83
Keep infrastructure adapters outside the domain model.
- Distinctive: line 84
Keep bounded contexts explicit.
- Distinctive: line 85
Do not leak persistence concerns into domain behavior.
- Distinctive: line 90
Use cases should express application behavior.
- Distinctive: line 125
Do not introduce interfaces for one implementation unless the boundary is meaningful.
- Distinctive: line 141
Before finishing an architectural change, verify:
- Distinctive: line 149
no layer gained unrelated responsibilities.
“Common” is measured: kept by at least 6 in 10 of the 3 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
Skill: architecture-principles
Purpose
Design and modify software while preserving boundaries, dependency direction, domain clarity, and long-term maintainability.
This skill covers Clean Architecture, Hexagonal Architecture, DDD, modularity, layering, dependency inversion, and boundary discipline.
First Rule
Respect the existing architecture.
Do not force Clean Architecture, DDD, CQRS, Event Sourcing, Hexagonal Architecture, microservices, or any other style unless:
- the repository already follows it;
- the change clearly requires it;
- or the user explicitly requests it.
Architecture is a tool. It is not a costume party for simple CRUD.
Dependency Direction
Prefer dependencies pointing toward stable business rules.
General direction:
Transport / UI / CLI
-> Application / Use Cases
-> Domain
Infrastructure / Persistence / External APIs
-> Application or Domain abstractionsRules:
- Domain rules must not depend on transport details.
- Domain rules must not depend on database models unless the repository intentionally uses active record style.
- Application/use-case code coordinates behavior but should not become a dumping ground.
- Infrastructure implements details and adapters.
- Transport layers should be thin.
Boundary Rules
Do not mix:
- routing and business policy;
- validation and persistence;
- domain rules and HTTP/CLI details;
- database schema models and public API schemas unless deliberate;
- configuration parsing and runtime behavior;
- hardware control and UI state;
- integration retries and domain decisions.
When boundaries are already messy, make the change without making them worse.
Domain-Driven Design
Use DDD where domain complexity justifies it.
Prefer DDD concepts when the codebase has:
- rich business rules;
- multiple domain concepts with invariants;
- workflows that need clear language;
- bounded contexts;
- domain events or policies;
- complex state transitions.
Do not use DDD ceremony for simple data plumbing.
DDD Practical Rules
- Use domain language in names.
- Keep invariants close to the domain model.
- Make invalid states hard or impossible to represent.
- Keep application orchestration separate from domain decisions.
- Keep infrastructure adapters outside the domain model.
- Keep bounded contexts explicit.
- Do not leak persistence concerns into domain behavior.
Clean Architecture Practical Rules
- Business rules should not know about frameworks.
- Use cases should express application behavior.
- Adapters translate between external systems and internal models.
- Interface boundaries should exist where they reduce coupling, not because diagrams enjoy arrows.
- Dependency inversion is useful when there are multiple implementations, test seams, or infrastructure volatility.
Package / Module Design
A package should have a reason to exist.
Good package reasons:
- one bounded context;
- one application capability;
- one integration boundary;
- one infrastructure adapter;
- one presentation area;
- one hardware responsibility.
Bad package reasons:
- "misc";
- "common" full of unrelated code;
- "services" as a junk drawer;
- "models" containing every shape in the universe.
Interface Rules
Introduce an interface/abstraction when it helps with:
- dependency inversion;
- testability;
- multiple implementations;
- external system isolation;
- stable domain/application contracts.
Do not introduce interfaces for one implementation unless the boundary is meaningful.
Data Flow
Make data flow explicit.
Avoid:
- hidden service locators;
- global mutable registries;
- implicit configuration reads everywhere;
- side-effectful imports;
- action-at-a-distance state changes.
Architecture Review Checklist
Before finishing an architectural change, verify:
- responsibilities are cohesive;
- dependency direction is preserved;
- public contracts are stable or intentionally changed;
- new abstractions have real callers or clear boundary value;
- errors cross boundaries in a controlled way;
- tests cover important behavior;
- no layer gained unrelated responsibilities.
Extended References
For deeper architecture work, read the relevant documents:
../../engineering/05_design_principles.md../../engineering/06_responsibility_model.md../../engineering/09_architectural_smells.md../../engineering/22_evolution_rules.md
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- vospr/context-engineering-template★ 9same name
- bolgovr/skills★ 1same name
- Khuirul-Huda/clean-principles★ 0same name
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 repository62 other files it gives its agents.
- AGENTS.mdAGENTS.md
- accessibility-ui-reviewSkill
- agent-retrospectiveSkill
- agents-md-retrospectiveSkill
- agent-squadSkill
- architecture-mapSkill
- architecture-normalizerSkill
- authz-boundary-reviewSkill
- c-cppSkill
- code-qualitySkill
- code-reviewSkill
- code-to-figmaSkill
- code-wiki-ruSkill
- context-packSkill
- core-engineeringSkill
- debuggingSkill
- dependency-advisory-auditSkill
- deserialization-parser-reviewSkill
- design-system-extractorSkill
- documentationSkill
- engineering-standardsSkill
- esp32Skill
- esphomeSkill
- external-agent-pack-auditSkill
- fastSkill
- figma-to-codeSkill
- fix-security-findingSkill
- goSkill
- homeassistantSkill
- mcp-tool-routerSkill
- migration-plannerSkill
- mobile-qaSkill
- multi-agent-pr-reviewSkill
- performanceSkill
- playwright-visual-qaSkill
- pythonSkill
- quality-gatesSkill
- refactoringSkill
- responsive-breakpoint-checkSkill
- review-routerSkill
- rustSkill
- secrets-and-config-reviewSkill
- security-diff-reviewSkill
- security-routerSkill
- securitySkill
- session-memorySkill
- specialist-dispatchSkill
- subagent-result-mergeSkill
- supply-chain-reviewSkill
- tdd-guardSkill
- testing-tddSkill
- threat-modelSkill
- typescriptSkill
- ui-buildSkill
- ui-business-appsSkill
- ui-concept-firstSkill
- ui-figmaSkill
- ui-qaSkill
- ui-researchSkill
- ui-routerSkill
- The first 60 shown.
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.

