service-provider-architecture
Installation
SKILL.md
Service Provider Architecture Skill
A comprehensive guide for structuring Laravel applications using the Service Provider pattern. Each domain entity is organized into a consistent set of artifacts — Model, DTO, Service, Controller, FormRequest, Resource, Policy, Event, Listener, and ServiceProvider — ensuring separation of concerns, testability, and maintainability.
Target users: Full-stack Laravel + React (Inertia.js) developers who want clean, domain-organized code with predictable patterns.
Core Principles
- Thin controllers — Controllers only receive requests, delegate to services, and return responses
- Fat services — All business logic lives in service classes, never in controllers or models
- Immutable DTOs — Data moves between layers via typed, readonly data transfer objects
- Smart models — Models define relationships, scopes, casts, and accessors, but no business logic
- Explicit authorization — Every action is authorized via policies, never inline in controllers
- Side effects via events — Notifications, logging, webhooks are decoupled through events/listeners