laravel-best-practices

Comprehensive Laravel development guidelines for writing clean, maintainable, and idiomatic code. This skill provides rules and examples for application architecture, database optimization, and code style. Use this when: (1) writing or refactoring Laravel code, (2) reviewing pull requests, (3) designing system architecture, or (4) optimizing performance.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "laravel-best-practices" with this command: npx skills add athallabf/laravel-best-practices/athallabf-laravel-best-practices-laravel-best-practices

Laravel Best Practices

A comprehensive guide to writing high-quality Laravel applications, inspired by Vercel's React Best Practices and community standards. Adhere to these rules to ensure your code is idiomatic, scalable, and maintainable. Compatible with Laravel 10, 11, and 12.

Core Categories

PriorityCategoryImpactRule Prefix
1Architecture & LogicCRITICALarch-
2Database & PerformanceHIGHdb-
3Code Quality & StyleMEDIUMstyle-

1. Architecture & Logic (CRITICAL)

  • arch-fat-models-skinny-controllers - Move logic from controllers to models/services.
  • arch-validation-in-form-requests - Extract validation rules to dedicated Request classes.
  • arch-business-logic-in-services - Encapsulate complex logic in Service classes.
  • arch-dependency-injection - Use IoC container for loose coupling.
  • arch-standard-tools - Use established Laravel tools and community packages.

2. Database & Performance (HIGH)

  • db-prevent-n-plus-one - Always eager load relationships (with()).
  • db-eloquent-over-raw-sql - Use Eloquent ORM for readability and security.
  • db-mass-assignment - Use fillable/guarded with create() or update().
  • db-chunk-data - Use chunk() or cursor() for large datasets.
  • db-eloquent-scopes - Reuse query logic with Eloquent scopes.

3. Code Quality & Style (MEDIUM)

  • style-naming-conventions - Follow standard Laravel naming (Singular/Plural).
  • style-no-env-directly - Access environment variables via config() only.
  • style-date-handling - Use UTC and Eloquent casts for date management.
  • style-descriptive-names - Code should be self-documenting; comments explain "why".
  • style-separate-js-css - Keep assets out of Blade templates.

How to Use

Refer to the individual rule files in the references/ directory for detailed explanations, "Bad" examples, and "Good" examples:

references/fat-models-skinny-controllers.md
references/prevent-n-plus-one.md
references/no-env-directly.md

Review Checklist

When building or reviewing Laravel code, ensure:

  1. Controllers are minimal (Skinny).
  2. Validation is in Form Requests.
  3. Queries are optimized (Eager loading).
  4. Logic is testable and separated.
  5. Environment variables are accessed via Config.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

laravel-best-practices

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

laravel-best-practices

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

openclaw-version-monitor

监控 OpenClaw GitHub 版本更新,获取最新版本发布说明,翻译成中文, 并推送到 Telegram 和 Feishu。用于:(1) 定时检查版本更新 (2) 推送版本更新通知 (3) 生成中文版发布说明

Archived SourceRecently Updated
Coding

ask-claude

Delegate a task to Claude Code CLI and immediately report the result back in chat. Supports persistent sessions with full context memory. Safe execution: no data exfiltration, no external calls, file operations confined to workspace. Use when the user asks to run Claude, delegate a coding task, continue a previous Claude session, or any task benefiting from Claude Code's tools (file editing, code analysis, bash, etc.).

Archived SourceRecently Updated