laravel-best-practices

Standardize Laravel 12 architecture, Eloquent usage, validation, and API design.

62|9|Updated Jan 16, 2026
One-click install
npx skills add https://github.com/AsyrafHussin/agent-skills --skill laravel-best-practices-asyrafhussin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-best-practices
Source: https://github.com/AsyrafHussin/agent-skills/tree/main/skills/laravel-best-practices
Command: npx skills add https://github.com/AsyrafHussin/agent-skills --skill laravel-best-practices-asyrafhussin

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Laravel projects often diverge in structure and patterns across teams, leading to maintenance pain and inconsistent quality. This Skill consolidates Laravel 12 conventions and best practices to standardize architecture, Eloquent usage, validation, API design, and PHP patterns.

Core Features & Use Cases

  • Standardized architecture patterns (Service Classes, Single-Purpose Actions, DTOs, Repositories, Value Objects)
  • Eloquent efficiency (eager loading, scopes, casts, events) and robust validation practices
  • RESTful controllers and API resource patterns to ensure consistent responses
  • Domain-driven structure and feature folders to improve maintainability and team collaboration
  • Clear guidelines for migrations, security, and performance

Quick Start

Apply these Laravel 12 conventions in your project to standardize architecture, validation, and Eloquent usage.

Frequently Asked Questions about laravel-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What's the best way to structure a Laravel 12 application for maintainability?

Standardize Laravel 12 architecture using service classes, single-purpose actions, and domain-driven feature folders to improve team collaboration and reduce maintenance pain across projects.

How do I implement DTOs and repository patterns in Laravel?

Implement DTOs and repository patterns in Laravel by applying consolidated best-practice conventions that separate data transport and persistence logic from controllers, ensuring consistent naming and robust domain-driven structures.

How do I optimize Eloquent queries to avoid performance issues in Laravel APIs?

Optimize Laravel Eloquent usage by applying eager loading, custom scopes, casts, and events, ensuring efficient database interactions and preventing N+1 query problems in your API design.

Does this Laravel best practices guidance cover RESTful API resource responses?

Yes, this guidance covers RESTful controllers and API resource patterns to ensure consistent responses across your application, standardizing how API endpoints handle and format data.

When should I use value objects over standard Eloquent models in Laravel?

Use value objects in Laravel when you need to encapsulate specific domain logic and validation rules immutably, complementing Eloquent models by keeping your domain-driven structure clean and maintainable.

Can I apply these Laravel conventions to existing projects with mixed structures?

You can apply these Laravel 12 conventions to existing projects by incrementally adopting service classes, validators, and feature folders to standardize architecture, Eloquent usage, and API design across your current codebase.