service-layer
Installation
SKILL.md
Service Layer Patterns
Sources: Martin Fowler — PoEAA (2002); Eric Evans — Domain-Driven Design (2003)
Pain Signals — You Are in This Branch When:
- Business rules (
if order.total > 1000: apply_discount()) live inside service classes - Controllers or API handlers contain domain logic
- Domain objects are anemic — they hold data but all behaviour is in services
- A service method does both "figure out what to do" and "do it"
- The same business rule appears in multiple service methods and drifts over time
- It is unclear whether a piece of logic belongs in a service or a domain object