laravel-expert

Provide expert Laravel and PHP development guidance on Eloquent ORM, API design, and testing.

Updated Feb 20, 2026
One-click install
npx skills add https://github.com/garethdaine/agent --skill laravel-expert-garethdaine
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-expert
Source: https://github.com/garethdaine/agent/tree/main/.cursor/skills/laravel-expert
Command: npx skills add https://github.com/garethdaine/agent --skill laravel-expert-garethdaine

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides expert guidance and best practices for developing robust applications using Laravel and PHP, addressing common challenges in areas like Eloquent ORM, API development, and testing.

Core Features & Use Cases

  • Eloquent Optimization: Learn to prevent N+1 queries, write efficient queries, and use atomic operations.
  • API & Controller Patterns: Implement RESTful controllers, service layers, and DTOs for clean code.
  • Testing & Error Handling: Write effective feature and Pest tests, and handle errors gracefully with custom exceptions.
  • Use Case: Refactor a slow-loading user list endpoint by applying eager loading techniques and optimizing database queries.

Quick Start

Apply the laravel-expert skill to refactor the provided User model to prevent N+1 query issues.

Frequently Asked Questions about laravel-expert

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

FAQPage Schema
How do I fix Eloquent N+1 query issues in Laravel?

Fix Eloquent N+1 query issues in Laravel by applying eager loading techniques to optimize database queries. Refactoring slow-loading endpoints involves loading relationships upfront to prevent excessive database calls and ensure scalable PHP application performance.

What is the best way to structure Laravel API controllers and service layers?

The best way to structure Laravel API controllers is by implementing RESTful patterns, dedicated service layers, and Data Transfer Objects (DTOs). This separation ensures clean code, maintains thin controllers, and centralizes business logic for maintainable PHP applications.

How do I write effective Pest and feature tests for Laravel APIs?

Write effective Pest and feature tests for Laravel APIs by structuring test cases to validate API resources, request validation, and error handling. The testing process ensures robust endpoint behavior by asserting responses and handling custom exceptions gracefully.

Does this guidance cover Laravel queue jobs and caching optimization?

Yes, this guidance covers Laravel queue jobs and caching optimization. It provides expert-level best practices for implementing background queue jobs and applying effective caching strategies to build highly scalable and performant PHP backend applications.

Why should I use DTOs and API resources in Laravel backend development?

Use DTOs and API resources in Laravel backend development to standardize data transformation and enforce request validation. They provide a clean boundary between database layers and API responses, ensuring consistent data formatting and robust error handling.