clean-architecture
БесплатноБез исполняемых скриптовНе проверенStructure software around the Dependency Rule: source code dependencies point inward from frameworks to use cases to entities. Use when the user mentions…
от onfire7777★ 17 звёзд на GitHubОб этом скилле
Clean Architecture Framework
A disciplined approach to structuring software so that business rules remain independent of frameworks, databases, and delivery mechanisms. Apply these principles when designing system architecture, reviewing module boundaries, or advising on dependency management.
Core Principle
Source code dependencies must point inward -- toward higher-level policies. Nothing in an inner circle can know anything about something in an outer circle. This single rule, applied consistently, produces systems that are testable, independent of frameworks, independent of the UI, independent of the database, and independent of any external agency.
The foundation: Software architecture is about drawing lines -- boundaries -- that separate things that matter from things that are details. Business rules are what matter. Databases, web frameworks, and delivery mechanisms are details. When details depend on policies (not the other way around), you can defer decisions, swap implementations, and test business logic in isolation.
Scoring
Goal: 10/10. When reviewing or creating software architecture, rate it 0-10 based on adherence to the principles below. A 10/10 means full alignment with all guidelines; lower scores indicate gaps to address. Always provide the current score and specific improvements needed to reach 10/10.
The Clean Architecture Framework
Six principles for building systems that survive the passage of time:
1. Dependency Rule and Concentric Circles
Core concept: The architecture is organized as concentric circles. The innermost circle contains Entities (enterprise business rules). The next circle contains Use Cases (application business rules). Then Interface Adapters. The outermost circle contains Frameworks and Drivers. Source code dependencies always point inward.
Why it works: When high-level policies don't depend on low-level details, you can change the database from MySQL to MongoDB, swap a web framework, or replace a REST API with GraphQL -- all without touching business logic. The system becomes resilient to the most volatile parts of the technology stack.
Key insights:
- The Dependency Rule is the overriding rule: inner circles cannot mention outer circle names (classes, functions, variables, data formats)
- Data that crosses boundaries must be in a form convenient for the inner circle, never in a form dictated by the outer circle
- Dependency Inversion (interfaces defined inward, implemented outward) is the mechanism that enforces the rule
- The number of circles is not fixed -- four is typical, but you may have more; the rule stays the same
- Frameworks are details, not architecture -- they belong in the outermost circle
Code applications:
| Context | Pattern | Example |
|---|---|---|
| Layer direction | Inner circles define interfaces; outer circles implement them | UserRepository interface in Use Cases; PostgresUserRepository in Adapters |
| Data crossing | DTOs or simple structs cross boundaries, not ORM entities | Use Case returns UserResponse DTO, not an ActiveRecord model |
| Framework isolation | Wrap framework calls behind interfaces | EmailSender interface hides whether you use SendGrid or SES |
| Database independence | Repository pattern abstracts persistence | Business logic calls repo.save(user), never raw SQL |
| Dependency direction | Import arrows on a diagram always point inward | Controller imports Use Case; Use Case never imports Controller |
See: references/dependency-rule.md
2. Entities and Use Cases
Core concept: Entities encapsulate enterprise-wide business rules -- the most general, highest-level rules that would exist even if no software system existed. Use Cases contain application-specific business rules that orchestrate the flow of data to and from Entities.
Why it works: By separating what the business does (Entities) from how the application orchestrates it (Use Cases), you can reuse Entities across multiple applications and change application behavior without altering core business rules.
Key insights:
- Entities are not database rows -- they are objects (or pure functions) that encapsulate critical business rules and data
- Use Cases describe application-specific automation rules; they orchestrate Entities but do not contain enterprise logic
- Use Cases accept Request Models and return Response Models -- never framework objects
- Each Use Case represents a single application operation (e.g.,
CreateOrder,ApproveExpense) - The Interactor pattern: a Use Case class implements an input boundary interface and calls an output boundary interface
- Changes to a Use Case should never affect an Entity; changes to an Entity may require Use Case updates
Code applications:
| Context | Pattern | Example |
|---|---|---|
| Entity design | Encapsulate critical business rules with |
Установить clean-architecture в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл clean-architecture?
Structure software around the Dependency Rule: source code dependencies point inward from frameworks to use cases to entities. Use when the user mentions "architecture layers", "dependency rule", "ports and adapters", "hexagonal architecture", or "use case boundary". Covers component principles, boundaries, and SOLID. For code quality, see clean-code. For domain modeling, see domain-driven-design.
Как установить скилл clean-architecture?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл clean-architecture запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic