laravel-best-practices

Apply Laravel best practices to backend PHP code reviews and refactors.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/muddassarsaleemiqbal/haulix-core --skill laravel-best-practices-muddassarsaleemiqbal
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-best-practices
Source: https://github.com/muddassarsaleemiqbal/haulix-core/tree/main/.github/skills/laravel-best-practices
Command: npx skills add https://github.com/muddassarsaleemiqbal/haulix-core --skill laravel-best-practices-muddassarsaleemiqbal

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Laravel projects often drift into inconsistent patterns, security gaps, and performance pitfalls as teams grow. This skill provides a comprehensive guardrail of recommended practices to harmonize code across controllers, models, migrations, requests, policies, jobs, and architecture, helping teams sustain high-quality Laravel backend PHP code over time.

Core Features & Use Cases

  • Enforces consistency across Laravel components (controllers, models, migrations, form requests, policies, jobs, queue setup, and service classes) to improve maintainability.
  • Guides performance, security, validation, error handling, routing, and architectural decisions through clearly defined rules and patterns.
  • Serves as a reference during code reviews and refactors to bring existing Laravel codebases in line with established best practices.

Quick Start

Provide a minimal Laravel project snippet illustrating adherence to best practices.

Frequently Asked Questions about laravel-best-practices

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

FAQPage Schema
What are Laravel best practices for structuring controllers, models, and migrations?

Laravel best practices enforce consistency across controllers, models, and migrations to keep backend PHP code clean and maintainable. This includes using form requests for validation, policies for authorization, and dedicated service classes for business logic.

How do I optimize Eloquent queries to prevent performance issues in my Laravel application?

To optimize Eloquent queries for performance, follow best practices like avoiding the N+1 problem using eager loading. This skill guides refactoring Eloquent queries and applying caching conventions to sustain high-quality backend PHP code.

How can I enforce security and validation standards during a Laravel code review?

You can enforce security and validation standards during a Laravel code review by applying rules for form requests, policies, and error handling. This skill serves as a reference to identify security gaps and bring existing codebases in line with established patterns.

Does this approach work for refactoring legacy PHP codebases to use Laravel architecture?

Yes, this approach works for refactoring legacy PHP codebases by guiding architectural decisions, routing conventions, and queue setup. It helps harmonize inconsistent patterns and integrate existing code with recommended Laravel components like jobs and scheduled commands.

When should I use Laravel jobs, scheduled commands, and service classes?

You should use Laravel jobs, scheduled commands, and service classes to offload heavy tasks and separate business logic from controllers. This skill enforces coding standards for these components, ensuring your backend PHP architecture remains clean and maintainable.