$npx skillfedfor your agent

laravel-best-practices

Laravel Best Practices is a comprehensive reference for building scalable Laravel 13 applications, covering 31 rules organized across architecture, Eloquent patterns, controllers, validation, security, performance, and API design. Use it when structuring applications, creating models and migrations, implementing form requests, or designing APIs. Includes essential patterns for service classes, repositories, form requests, and Eloquent models.

Laravel Best Practices provides 31 rules across architecture, Eloquent, controllers, validation, security, performance, and API design for Laravel 13 applications.

AI-generated summary based on this skill's SKILL.md

58 9 MITupdated by AsyrafHussin

Decision gist · record as of 2026-05-16

Laravel Best Practices provides 31 rules across architecture, Eloquent, controllers, validation, security, performance, and API design for Laravel 13 applications. Laravel Best Practices is a comprehensive reference for building scalable Laravel 13 applications, covering 31 rules organized across architecture, Eloquent patterns, controllers, validation, security, performance, and API design. Use it when structuring applications, creating models and migrations, implementing form requests, or designing APIs. Includes essential patterns for service classes, repositories, form requests, and Eloquent models.

manual: git clone https://github.com/AsyrafHussin/agent-skills → cp -r agent-skills/skills/laravel-best-practices ~/.claude/skills/laravel-best-practices
skills/laravel-best-practices/SKILL.md · version 87887ba0

Use it when

  • Laravel Best Practices emphasizes using Eloquent eager loading to prevent N+1 query problems.
  • Laravel Best Practices advocates keeping controllers thin and focused on HTTP concerns—routing requests to appropriate services.

Verify before relying

Read SKILL.md below before installing (37 files). Open directory: indexed for reading, not audited.

Same gist for agents: .md · .json

Install

AsyrafHussin/agent-skills/laravel-best-practices

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

What are the key Laravel 13 best practices for application structure?

Laravel Best Practices recommends organizing your Laravel 13 application by separating concerns across controllers, models, services, and repositories. Follow the framework's conventions for directory structure, use feature-folder organization when appropriate, and implement dependency injection throughout. Adhere to RESTful resource controller patterns, keep business logic in service classes rather than controllers, and use form requests for validation. This architecture ensures scalability and maintainability as your application grows.

How do you prevent N+1 queries and optimize Eloquent database access?

Laravel Best Practices emphasizes using Eloquent eager loading to prevent N+1 query problems. Load relationships upfront with methods like `with()` or `load()` rather than lazy-loading them in loops. Use `select()` to fetch only needed columns, leverage query scopes for reusable filters, and profile queries with Laravel's query log. Consider pagination for large datasets and use database indexes strategically. These Eloquent optimization techniques significantly improve application performance.

What is the proper way to structure controllers, models, and services?

Laravel Best Practices advocates keeping controllers thin and focused on HTTP concerns—routing requests to appropriate services and returning responses. Models should contain only data relationships and query scopes, not business logic. Service classes encapsulate business rules and complex operations, promoting reusability and testability. Use repositories for data access abstraction when needed, and implement dependency injection to wire these components together cleanly.

How should Laravel form request validation and handling be implemented?

Laravel Best Practices recommends using FormRequest classes to centralize validation logic separate from controllers. Define rules in the `rules()` method, customize messages with `messages()`, and use the `authorize()` method for permission checks. This keeps controllers clean and makes validation reusable across multiple endpoints. Leverage Laravel's built-in validators and custom rule classes for complex validation scenarios, ensuring data integrity before processing.

What security measures protect Laravel applications from mass assignment?

Laravel Best Practices emphasizes using the `$fillable` or `$guarded` properties on Eloquent models to control which attributes can be mass-assigned. Always validate user input through form requests before creating or updating models. Implement proper authorization checks using policies and gates, sanitize user data, and use prepared statements through Eloquent to prevent SQL injection. These practices build secure, scalable Laravel applications resistant to common vulnerabilities.

How do you build scalable and maintainable Laravel API applications?

Laravel Best Practices recommends designing APIs with clear resource controllers, consistent response formatting, and proper HTTP status codes. Use API resources to transform model data, implement pagination for large datasets, and version your API endpoints when needed. Apply the same architectural principles—service classes, form requests, repositories—to API code. Leverage Laravel's built-in features like API rate limiting, CORS configuration, and token authentication to create secure, scalable APIs.

SKILL.md

Rendered from the published skill. Quoted content, verbatim.

Laravel 13 Best Practices

Comprehensive best practices guide for Laravel 13 applications. Contains 31 rules across 7 categories for building scalable, maintainable Laravel applications.

When to Apply

Reference these guidelines when: - Creating controllers, models, and services - Writing migrations and database queries - Implementing validation and form requests - Building APIs with Laravel - Structuring Laravel applications

Rule Categories by Priority

Priority Category Impact Prefix
1 Architecture & Structure CRITICAL arch-
2 Eloquent & Database CRITICAL eloquent-
3 Controllers & Routing HIGH controller-, ctrl-
4 Validation & Requests HIGH validation-,

(truncated - see the full file via the links below)

File tree — 15 files
skills/laravel-best-practices/AGENTS.md
skills/laravel-best-practices/README.md
skills/laravel-best-practices/SKILL.md
skills/laravel-best-practices/metadata.json
skills/laravel-best-practices/rules/_sections.md
skills/laravel-best-practices/rules/_template.md
skills/laravel-best-practices/rules/arch-action-classes.md
skills/laravel-best-practices/rules/arch-dto-pattern.md
skills/laravel-best-practices/rules/arch-event-driven.md
skills/laravel-best-practices/rules/arch-feature-folders.md
skills/laravel-best-practices/rules/arch-queue-routing.md
skills/laravel-best-practices/rules/arch-repository-pattern.md
skills/laravel-best-practices/rules/arch-service-classes.md
skills/laravel-best-practices/rules/arch-value-objects.md
skills/laravel-best-practices/rules/controller-api-resources.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 13 architectural patterns and best practices”

Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →

Related skills

laravel-patterns
by affaan-m · affaan-m/ECC

Master Laravel's architecture through proven patterns for building maintainable, production-ready applications. Covers controller and service layer design, Eloquent modeling with relationships and scopes, API resource structuring, and background job handling with queues and events.

MITupdated Jul 2026
★ 234,207repo stars
Laravel
by rawveg · rawveg/skillsforge-marketplace

Get expert guidance on Laravel 12.x application development, from foundational concepts like routing and database migrations to advanced patterns including Eloquent relationships, API design, and authentication with Sanctum. This skill covers the full development lifecycle—models, validation, queues, dependency injection, and best practices for building scalable web applications.

no license declared → metadata onlyupdated Feb 2026
★ 39repo stars
eloquent-best-practices
by iSerter · iSerter/laravel-claude-agents

This skill teaches proven patterns for writing efficient Eloquent queries, from eager loading relationships to selecting only needed columns and using query scopes. Learn how to prevent common performance pitfalls like N+1 queries, implement mass assignment protection, and leverage database-level operations for faster data manipulation.

MITupdated Apr 2026
★ 41repo stars
php-expert
by personamanagmentlayer · personamanagmentlayer/pcl

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.

Apache-2.0updated Mar 2026
★ 38repo stars
laravel-specialist
by Jeffallan · Jeffallan/claude-skills

Laravel Specialist guides you through building production-ready Laravel 10+ applications with type-safe Eloquent models, queue workers, API resources, and Livewire components. It enforces modern PHP 8.2+ patterns, eager loading, dependency injection, and >85% test coverage across feature and unit tests. Use it for architecting database schemas, implementing authentication flows, optimizing queries, and validating code against PSR-12 standards.

MITupdated May 2026
★ 10,759repo stars
laravel-database-optimization
by AsyrafHussin · AsyrafHussin/agent-skills

This skill provides 33 optimization rules across 9 categories for Laravel 13 applications, covering eager loading, indexing strategies, Redis caching, pagination, and transaction handling. Use it when writing Eloquent queries, diagnosing N+1 issues, configuring indexes, or debugging slow queries with Laravel Debugbar.

MITupdated May 2026
★ 58repo stars

More skills laravel-systematic-debugging (MIT) · laravel-authorization-patterns (MIT) · laravel-specialist (MIT) · laravel-inertia-react (MIT) · laravel-api-resource-patterns (MIT) · laravel-api (MIT) · git-workflow (MIT)

Tags
code-organizationdatabase-optimizationapi-developmentsecurity-patternsperformance-tuningarchitectural-designvalidation-ruleseloquent-ormscalability-guidephp-framework