laravel-best-practices

Enforce Laravel best practices across controllers, models, migrations, and jobs.

3|2|Updated Nov 4, 2025
One-click install
npx skills add https://github.com/y-l-g/saasterkit --skill laravel-best-practices-y-l-g
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-best-practices
Source: https://github.com/y-l-g/saasterkit/tree/main/.agents/skills/laravel-best-practices
Command: npx skills add https://github.com/y-l-g/saasterkit --skill laravel-best-practices-y-l-g

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Laravel projects often suffer from inconsistent architecture, N+1 query patterns, insecure data handling, and maintenance pain as teams scale. This Skill consolidates practical guidelines to write, review, and refactor Laravel PHP code for consistency, performance, and security.

Core Features & Use Cases

  • Enforces correct relationship types, local scopes, and policy-based authorization to align backend components.
  • Improves performance with eager loading, selective column queries, and safe query patterns for common app scenarios.
  • Provides structured patterns for code reviews, refactoring, and onboarding to accelerate development velocity.

Quick Start

Evaluate a Laravel module and apply a checklist to enforce eager loading, validated requests, and consistent naming across controllers and models.

Frequently Asked Questions about laravel-best-practices

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

FAQPage Schema
How do I fix N+1 query problems in Laravel applications?

Fix Laravel N+1 query problems by applying eager loading patterns to relationship queries. This Skill enforces selective column queries and safe query patterns to optimize backend performance and eliminate redundant database calls during data retrieval.

What is the best way to structure Laravel controllers and models for maintainability?

The best way to structure Laravel controllers and models is enforcing correct relationship types, local scopes, and policy-based authorization. This Skill provides actionable guardrails and reusable patterns for team-wide consistency and maintainable architecture.

How do I add proper validation and secure data flows in Laravel requests?

Add proper validation and secure data flows in Laravel requests by implementing structured request validation patterns. This Skill refactors legacy modules to enforce validated requests and secure data handling across controllers and policies.

Does this Laravel best practices guidance work for refactoring legacy PHP modules?

Yes, this Laravel best practices guidance works for refactoring legacy PHP modules. It applies checklists to evaluate existing modules, reduce N+1 queries, and enforce consistent naming and authorization across controllers and models.

Can I use this to standardize Laravel code reviews for my development team?

Yes, you can use this to standardize Laravel code reviews for your development team. It provides structured patterns for code reviews, refactoring, and onboarding to accelerate development velocity and ensure consistent backend architecture.