Laravel Idioms
Learn Laravel's idiomatic approach to building maintainable applications through Eloquent query scopes, service-oriented architecture, and Form Request validation. Covers testing with Pest, code formatting with Pint, and static analysis via PHPStan to enforce framework best practices.
Laravel Idioms teaches framework conventions for Eloquent, services, validation, and testing.
AI-generated summary based on this skill's SKILL.md
Decision gist · record as of 2026-07-17
Laravel Idioms teaches framework conventions for Eloquent, services, validation, and testing. Learn Laravel's idiomatic approach to building maintainable applications through Eloquent query scopes, service-oriented architecture, and Form Request validation. Covers testing with Pest, code formatting with Pint, and static analysis via PHPStan to enforce framework best practices.
Use it when
- Laravel Idioms addresses the N+1 query problem through Eloquent's eager loading features.
- Laravel Idioms demonstrates the service layer pattern: controllers handle HTTP concerns (requests, responses, routing).
Verify before relying
Read SKILL.md below before installing (1 file). Open directory: indexed for reading, not audited.
Install
irahardianto/awesome-agv/laravel-idioms · repository language: JavaScript
Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.
Frequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How to write idiomatic Laravel code following framework conventions?
Laravel Idioms teaches you to embrace the framework's opinionated patterns: use Eloquent scopes for query reusability, keep controllers thin by delegating business logic to service classes, and leverage Form Request validation for clean input handling. The skill covers Laravel's conventions around naming, file structure, and architectural layers so your code feels natural to other Laravel developers and stays maintainable as your application grows.
What's the best way to prevent N+1 query problems in Laravel?
Laravel Idioms addresses the N+1 query problem through Eloquent's eager loading features. Learn to use `with()` and `load()` to fetch related data in a single query, apply query scopes to encapsulate complex conditions, and recognize when lazy loading creates performance bottlenecks. The skill teaches you to profile queries and structure your Eloquent models so you avoid unnecessary database round-trips.
How should Laravel service layer and thin controllers be structured?
Laravel Idioms demonstrates the service layer pattern: controllers handle HTTP concerns (requests, responses, routing), while services contain business logic, database interactions, and domain rules. This separation keeps controllers thin and testable, makes services reusable across multiple endpoints, and clarifies where to add new features. You'll learn when to extract logic into services and how to inject them cleanly into your controllers.
Which testing, validation, and code quality tools does Laravel Idioms cover?
Laravel Idioms includes Pest for modern, expressive testing; Form Request validation for declarative input rules; PHPStan with Larastan for static analysis that catches type errors early; and Pint for automated code formatting. Together these tools enforce Laravel best practices, catch bugs before production, and ensure your codebase meets quality standards without manual review overhead.
What are Laravel Eloquent scopes and how do they apply DRY principles?
Laravel Idioms teaches Eloquent scopes as reusable query filters that live on your models. Instead of repeating `where()` clauses across your application, define a scope once—like `scopeActive()` or `scopeRecent()`—and chain it wherever needed. This DRY approach keeps query logic centralized, makes it easy to update filtering rules, and makes your code more readable by expressing intent rather than raw SQL conditions.
How do Laravel accessors and mutators improve code maintainability?
Laravel Idioms covers accessors and mutators as Eloquent features that transform attribute values on retrieval and storage. Use them to format dates, encrypt sensitive data, or compute derived properties without cluttering your controller or service logic. This keeps data transformation rules colocated with your model, makes attributes behave consistently across your application, and reduces the chance of formatting bugs.
SKILL.md
Rendered from the published skill. Quoted content, verbatim.
Laravel Idioms and Patterns
Laravel rewards convention, Eloquent, and expressive syntax. Idiomatic Laravel = DRY, service-oriented, well-tested.
> Scope: Laravel-specific patterns. For PHP: @.agents/skills/php-idioms/SKILL.md.
Eloquent
-
Scopes for reusable queries:
php class Task extends Model { public function scopeActive(Builder $query): Builder { return $query->where('status', 'active'); } } // Usage: Task::active()->paginate(25); -
Eager loading to avoid N+1:
Task::with('user', 'tags')->get(). - Accessors/Mutators with
Attributecast (Laravel 9+).
Service Layer
-
Services for business logic — controllers stay thin: ```php class TaskService { public function __construct( private readonly TaskRepository $repository, ) {}
public function create(CreateTaskRequest $request): Task { ... } } ```
Validation
- Form Requests for validation — never validate in controllers: ```php class CreateTaskRequest extends FormRequest { public function
(truncated - see the full file via the links below)
File tree — 1 file
.agents/skills/laravel-idioms/SKILL.md
Let your AI agent find skills like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.
wish › “Learn Laravel framework conventions and idiomatic patterns”
Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →
Related skills
This skill covers idiomatic PHP 8.x development, emphasizing strict typing, immutable data structures via readonly classes and enums, and domain-driven error handling. Learn named arguments, match expressions, constructor injection, and PSR-12 naming conventions alongside static analysis tools like PHPStan and Psalm.
PHP Specialist guides you through modern PHP 8.x development with language features like enums, readonly properties, and match expressions. It covers the complete toolchain: PSR interoperability, Composer dependency management, static analysis configuration, and coding standards enforcement. Apply it whenever you're authoring, reviewing, or refactoring PHP code to ensure type safety and architectural correctness.
Learn idiomatic Spring Boot 3.x patterns grounded in auto-configuration, constructor injection, and actuator-driven observability. Covers dependency injection best practices, Spring Data JPA query methods and projections, REST controller design with DTOs, and structured logging for production readiness. Includes testing patterns for integration and controller slices.
PHP Rules enforces coding standards covering style, frameworks, patterns, security, and testing. It guides PSR-12 compliance, modern PHP 8.1+ syntax, Laravel and Symfony conventions, Eloquent and Doctrine patterns, and error handling best practices.
PHP Pro is a senior-level specialist for modern PHP development with Laravel, Symfony, and PHP 8.3+. It enforces strict typing, dependency injection, and PSR compliance while generating typed DTOs, services, controllers, and comprehensive tests. Every implementation passes PHPStan level 9 and PHPUnit/Pest coverage thresholds before delivery.
PHP Expert provides in-depth instruction on PHP 8+ language features including union types, named arguments, match expressions, attributes, and enums. Learn Laravel framework patterns, Composer dependency management, and object-oriented design principles for building robust applications.
More skills django-idioms (MIT) · laravel-specialist (MIT) · Csharp Idioms (MIT) · Dotnet Idioms (MIT) · laravel-testing (MIT) · Java Idioms (MIT) · Elixir Idioms (MIT) · angular-idioms (MIT)