> laravel-clean-architecture
Expert patterns for DDD, DTOs, and Ports & Adapters in Laravel. Use when applying Domain-Driven Design, DTOs, or ports-and-adapters patterns in Laravel. (triggers: app/Domains/**/*.php, app/Providers/*.php, domain, dto, repository, contract, adapter)
curl "https://skillshub.wtf/HoangNguyen0403/agent-skills-standard/laravel-clean-architecture?format=md"Laravel Clean Architecture
Priority: P1 (HIGH)
Structure
app/
├── Domains/ # Logic grouped by business domain
│ └── {Domain}/
│ ├── Actions/ # Single use-case logic
│ ├── DTOs/ # Immutable data structures
│ └── Contracts/ # Interfaces for decoupling
└── Providers/ # Dependency bindings
Implementation Guidelines
- Domain Grouping: Organize code by business domain (e.g.,
User,Order) instead of framework types. - DTOs: Use
readonlyclasses to pass data between layers; avoid raw arrays. - Action Classes: Wrap business logic in single-purpose classes with
handle()orexecute(). - Repository Pattern: Abstract Eloquent queries behind interfaces for easier testing.
- Dependency Inversion: Bind Interfaces to implementations in
AppServiceProvider. - Model Isolation: Keep Eloquent models lean; only include relationships and casts.
Anti-Patterns
- Domain Leak: No Eloquent in Controllers: Use DTOs/Actions to bridge layers.
- Array Overload: No raw data arrays: Use typed DTOs for structured data.
- Service Bloat: No God Services: Break down large services into granular Actions.
- Infrastructure Coupling: No hard dependencies: Depend on abstractions, not concretions.
References
> related_skills --same-repo
> typescript-tooling
Development tools, linting, and build config for TypeScript. Use when configuring ESLint, Prettier, Jest, Vitest, tsconfig, or any TS build tooling. (triggers: tsconfig.json, .eslintrc.*, jest.config.*, package.json, eslint, prettier, jest, vitest, build, compile, lint)
> typescript-security
Secure coding practices for TypeScript. Use when validating input, handling auth tokens, sanitizing data, or managing secrets and sensitive configuration. (triggers: **/*.ts, **/*.tsx, validate, sanitize, xss, injection, auth, password, secret, token)
> typescript-language
Modern TypeScript standards for type safety and maintainability. Use when working with types, interfaces, generics, enums, unions, or tsconfig settings. (triggers: **/*.ts, **/*.tsx, tsconfig.json, type, interface, generic, enum, union, intersection, readonly, const, namespace)
> typescript-best-practices
Idiomatic TypeScript patterns for clean, maintainable code. Use when writing or refactoring TypeScript classes, functions, modules, or async logic. (triggers: **/*.ts, **/*.tsx, class, function, module, import, export, async, promise)