laravel-best-practices

Fix Laravel PHP code quality issues across controllers, models, and queries.

1|1|Updated Jul 6, 2025
One-click install
npx skills add https://github.com/JayonLabs/StockEase --skill laravel-best-practices-jayonlabs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-best-practices
Source: https://github.com/JayonLabs/StockEase/tree/main/.agents/skills/laravel-best-practices
Command: npx skills add https://github.com/JayonLabs/StockEase --skill laravel-best-practices-jayonlabs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you write, review, and refactor Laravel code with confidence by applying proven best practices for performance, security, validation, routing, testing, and maintainability. It reduces inconsistent patterns, hidden bugs, and inefficient database behavior in real Laravel projects.

Core Features & Use Cases

  • Database and Eloquent guidance: Prevent N+1 queries, choose the right relationship types, use scopes, and keep queries efficient.
  • Security and validation checks: Enforce mass-assignment protection, authorization, safe file uploads, and form request validation.
  • Architecture and code organization: Improve controller structure, extract actions or services, and follow Laravel conventions consistently.
  • Use case: Review a feature implementation before merge and tighten queries, authorization, and validation without changing the app’s established style.

Quick Start

Use this skill to review the Laravel code you are editing and refactor it to match the project’s existing patterns and the most relevant best practices.

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 Eloquent?

Fix Laravel N+1 query problems by enforcing eager loading on Eloquent relationships. This skill automatically identifies lazy-loaded relationships in your models and controllers, applying eager loading constraints to optimize database queries and prevent performance bottlenecks.

What's the best way to handle Laravel validation and mass-assignment security?

Handle Laravel validation and mass-assignment security by enforcing form request validation and fillable model properties. This skill checks your controllers and models to ensure safe file uploads, proper authorization, and strict mass-assignment protection across your application.

How do I review Laravel code for performance and architecture issues before merging?

Review Laravel code for performance and architecture issues by analyzing controllers, services, and queries during refactoring. This skill tightens routing, validates authorization policies, and enforces maintainable architecture without changing your repository's established conventions.

Can this skill enforce reversible migrations and queue discipline in existing Laravel projects?

Yes, it enforces reversible migrations and queue discipline in existing Laravel projects. The skill reviews scheduled commands, jobs, and cache usage, applying best practices for safe database migrations and efficient background processing while adhering to your current codebase patterns.

Does this skill work with Blade views and Laravel testing workflows?

Yes, it works with Blade views and Laravel testing workflows. The skill applies framework-specific best practices to Blade templates and test suites, improving code organization, query efficiency, and validation safety across greenfield development and active code review.