separating-business-logic
Installation
SKILL.md
Separating Business Logic
When to use
- Designing a new feature from scratch
- Splitting a god service into layers
- Moving business rules out of controllers or infrastructure
Core rules
- Domain layer: Pure business rules, no framework, no I/O, no
console.log - Application layer: Use-cases orchestrate domain + ports, no HTTP/DB direct
- Infrastructure layer: Adapters for HTTP, DB, 3rd-party, implements ports
- Controllers/handlers: only parse input, call one use-case, map Result to response
- Domain entities contain invariants (rules that must always hold) and behavior