Use when designing system architecture, component structure, data models, or evaluating architectural decisions. Covers system design, component boundaries, data flow, and scalability considerations.
Structured system design and component architecture. Use this when making decisions about how components relate, where data lives, and how the system scales.
Core principle: Good architecture makes the system easy to understand, easy to change, and hard to break.
lib/features/<feature>/
├── data/ # Repositories, data sources
├── domain/ # Models, business logic
└── presentation/ # Screens, widgets, state
| Principle | Application |
|---|---|
| Single Responsibility | One reason to change per component |
| Open/Closed | Extend behavior without modifying existing code |
| Dependency Inversion | Depend on abstractions, not concretions |
| Interface Segregation | Small, focused interfaces |
| YAGNI | Don't build what you don't need yet |
| DRY | Extract shared logic, but only after 3+ duplications |
For significant architecture decisions, document: