laravel-12-best-practices

Codify Laravel 12.x best practices for architecture, Eloquent, testing, and security.

Updated Feb 8, 2026
One-click install
npx skills add https://github.com/mbuyco/agent-skills --skill laravel-12-best-practices
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-12-best-practices
Source: https://github.com/mbuyco/agent-skills/tree/main/laravel-12-best-pratices
Command: npx skills add https://github.com/mbuyco/agent-skills --skill laravel-12-best-practices

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Laravel 12.x project maintenance and quality can drift without standardized practices. This Skill provides a consolidated guide covering architecture, Eloquent usage, testing, security, and starter-kit considerations to help teams ship consistent, robust Laravel apps.

Core Features & Use Cases

  • Architecture & Coding Standards: Align project structure, strict typing, and domain-oriented organization.
  • Quality & Testing: Standardize linting with Pint, static analysis with PHPStan, and refactoring with Rector; adopt Pest or PHPUnit testing conventions.
  • Eloquent & Data Access: Follow UUIDv7 patterns, consistent resource transformations, and query strictness to prevent N+1 issues.
  • Starter Kits & Performance: Guidance on official Laravel starter kits, Inertia integration, and performance-conscious defaults.

Quick Start

Start a new Laravel 12.x project with strict types, install Pint, PHPStan, and Rector, adopt the recommended directory layout, and implement FormRequest validation and policy-based authorization.

Frequently Asked Questions about laravel-12-best-practices

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

FAQPage Schema
How do I enforce Laravel 12 best practices for architecture and strict typing?

Laravel 12 best practices enforce strict typing and domain-oriented architecture by aligning project structure, applying strict type declarations, and organizing domain logic to improve maintainability and code quality.

What's the best way to configure PHPStan and Rector for a Laravel 12 project?

Configure PHPStan and Rector for a Laravel 12 project by standardizing static analysis and automated refactoring rules, ensuring code quality and consistency alongside Pint linting conventions.

How do I prevent N+1 query issues in Laravel 12 Eloquent?

Prevent N+1 query issues in Laravel 12 Eloquent by following query strictness conventions, consistent resource transformations, and UUIDv7 patterns to optimize data access and prevent performance bottlenecks.

Does this Laravel 12 best practices guide work for legacy projects?

Yes, these Laravel 12 best practices apply to both greenfield and legacy projects, guiding architecture adjustments, Eloquent discipline, testing strategies, and security hardening for existing codebases.

What testing conventions should I adopt for Laravel 12?

Adopt Pest or PHPUnit testing conventions for Laravel 12 to standardize quality and testing strategies, ensuring robust application behavior and maintainable test suites across the project lifecycle.

How do I integrate Inertia and official starter kits in Laravel 12?

Integrate Inertia and official starter kits in Laravel 12 by following performance-conscious defaults and starter-kit adoption guidance to ensure consistent, robust application scaffolding.