laravel-architecture

leeovery's avatarfrom leeovery

High-level architecture decisions, patterns, and project structure. Use when user asks about architecture decisions, project structure, pattern selection, or mentions how to organize, which pattern to use, best practices, architecture.

⭐3stars🔀0forks📁View on GitHub🕐Updated Dec 18, 2025

When & Why to Use This Skill

This Claude skill provides expert-level architectural guidance for Laravel applications, focusing on scalable design patterns and robust project organization. It assists developers in implementing core principles such as Actions for domain logic, DTOs for data transfer, and strict type safety to ensure maintainable, high-quality codebases that follow modern PHP best practices.

Use Cases

  • Scenario 1: Structuring a new Laravel project from scratch using standardized directory layouts and namespace conventions for better scalability.
  • Scenario 2: Refactoring 'fat' controllers by moving complex business logic into invokable Action classes and implementing DTOs for type-safe data handling.
  • Scenario 3: Selecting the most appropriate design patterns, such as choosing between State Machines for complex transitions or simple Enums for basic state management.
  • Scenario 4: Establishing a 'Type Safety First' development workflow by enforcing strict typing and declarative code patterns across the entire engineering team.
  • Scenario 5: Designing external API integrations using specialized service patterns and tools like Saloon to maintain a clean separation of concerns.
namelaravel-architecture
descriptionHigh-level architecture decisions, patterns, and project structure. Use when user asks about architecture decisions, project structure, pattern selection, or mentions how to organize, which pattern to use, best practices, architecture.

Laravel Architecture

High-level architectural guidance for Laravel applications.

Core Concepts

philosophy.md - Foundational principles:

  • Declarative code above all else
  • Strict separation of concerns
  • Type safety first
  • All core architectural principles

patterns.md - Pattern overview:

  • Actions for domain logic
  • DTOs for data transfer
  • State machines for complex state
  • Services for external integration
  • Workflows for multi-step processes
  • Value objects for domain values

decisions.md - Pattern selection:

  • When to use each pattern
  • Decision flowcharts
  • Architectural trade-offs
  • Common scenarios

structure.md - Directory structure:

  • Complete project organization
  • File placement rules
  • Namespace conventions
  • Web vs API distinction

examples.md - Reference implementations:

  • Complete working examples
  • End-to-end workflows
  • Real-world patterns

checklist.md - Implementation checklist:

  • Setup tasks
  • Feature development workflow
  • Production deployment steps

Core Principles

  1. Actions contain domain logic - Business logic lives in invokable action classes
  2. Never pass primitives - Always use DTOs for data transfer
  3. Thin HTTP layer - Controllers only handle HTTP concerns
  4. Custom query builders - Type-safe queries over scopes
  5. Strict typing - declare(strict_types=1) in every file

Quick Decision Tree

Need to...

  • Handle domain logic? → Action
  • Transfer data? → DTO
  • Validate user input? → Form Request
  • Simple state field? → Enum
  • Complex state transitions? → State Machine
  • External API? → Service with Saloon
  • Background processing? → Job (delegates to Action)

Read decision flowcharts in decisions.md for detailed guidance.