Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

laravel-best-practices

/laravel-best-practices

Stosuje dobre praktyki Laravel przy kontrolerach, modelach, migracjach, zapytaniach Eloquent, cachowaniu, autoryzacji i kolejkach.

Repozytorium
coolify ↗
Licencja
Apache-2.0
Ostatnia zmiana repozytorium
27.10.2026

Ocena i bezpieczeństwo

90/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść25 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
20
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 27.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

Co robi i kiedy

Stosuje dobre praktyki Laravel przy kontrolerach, modelach, migracjach, zapytaniach Eloquent, cachowaniu, autoryzacji i kolejkach.

Oryginalny opis (EN)

Apply this skill whenever writing, reviewing, or refactoring Laravel PHP code. This includes creating or modifying controllers, models, migrations, form requests, policies, jobs, scheduled commands, service classes, and Eloquent queries. Triggers for N+1 and query performance issues, caching strategies, authorization and security patterns, validation, error handling, queue and job configuration, route definitions, and architectural decisions. Also use for Laravel code reviews and refactoring existing Laravel code to follow best practices. Covers any task involving Laravel backend PHP code patt

Jak działa

  1. Consistency First
  2. How to Apply
  3. Rule Index
  4. Decision Rules
Sekcje z nagłówków SKILL.md, w oryginale · 53 linii, 495 słów
Podgląd SKILL.md
---
name: laravel-best-practices
description: "Apply this skill whenever writing, reviewing, or refactoring Laravel PHP code. This includes creating or modifying controllers, models, migrations, form requests, policies, jobs, scheduled commands, service classes, and Eloquent queries. Triggers for N+1 and query performance issues, caching strategies, authorization and security patterns, validation, error handling, queue and job configuration, route definitions, and architectural decisions. Also use for Laravel code reviews and refactoring existing Laravel code to follow best practices. Covers any task involving Laravel backend PHP code patterns."
license: MIT
metadata:
  author: laravel
---

# Laravel Best Practices

Best practices for Laravel, organized as an index of rule files. Each rule file teaches what to do and why. For exact API syntax, verify with `search-docs`.

## Consistency First

Before applying any rule, check what the application already does. Laravel offers multiple valid approaches, and the best choice is the one the codebase already uses, even if another pattern would be theoretically better. Inconsistency is worse than a suboptimal pattern.

Check sibling files, related controllers, models, or tests for established patterns. If one exists, follow it. Don't introduce a second way. These rules are defaults for when no pattern exists yet, not overrides.

## How to Apply

1. Check the changed files, nearby code, project configuration, and relevant tests for established patterns. Deviate only for a correctness or security defect, and call the deviation out.
2. Map every affected concern to the rule index below. Read each mapped rule file before editing. Skip unrelated rule files.
3. Make the smallest coherent change. Keep the application's architecture and naming instead of introducing a second pattern for the same job.
4. Verify version-sensitive Laravel APIs for the installed version with `search-docs`, or inspect the installed framework when it is unavailable.
5. Run the narrowest relevant tests first, then the project's formatting and static-analysis checks when the change warrants them.
6. Re-read the diff against every mapped rule before finishing.

## Rule Index

Cross-cutting changes often need more than one rule file.

| Concern | Read |
| --- | --- |
| Query count, eager loading, indexes, large datasets | [`rules/db-performance.md`](rules/db-performance.md) |
| Subqueries, aggregates, complex ordering and query plans | [`rules/advanced-queries.md`](rules/advanced-queries.md) |
| Models, relationships, scopes, casts | [`rules/eloquent.md`](rules/eloquent.md) |
| Authentication, authorization, input safety, secrets, uploads | [`rules/security.md`](rules/security.md) |
| Form Requests and validation rules | [`rules/validation.md`](rules/validation.md) |
| Controllers, route binding, resources, middleware | [`rules/routing.md`](rules/routing.md) |
| Schema changes, columns, foreign keys, indexes | [`rules/migrations.md`](rules/migrations.md) |
| Jobs, retries, uniqueness, batches, Horizon | [`rules/queue-jobs.md`](rules/queue-jobs.md) |
| Cache lifetime, invalidation, locks, memoization | [`rules/caching.md`](rules/caching.md) |
| Outbound requests, retries, timeouts, fakes | [`rules/http-client.md`](rules/http-client.md) |
| Exceptions, reporting, rendering, log context | [`rules/error-handling.md`](rules/error-handling.md) |
| Events and notifications | [`rules/events-notifications.md`](rules/events-notifications.md) |
| Mailables and mail assertions | [`rules/mail.md`](rules/mail.md) |
| Scheduled tasks and overlap protection | [`rules/scheduling.md`](rules/scheduling.md) |
| Collections, lazy iteration, bulk operations | [`rules/collections.md`](rules/collections.md) |
| Blade components, attributes, composers | [`rules/blade-views.md`](rules/blade-views.md) |
| Environment values and application configuration | [`rules/config.md`](rules/config.md) |
| Tests: coverage, factories, fakes, and assertions | the `testing-best-practices` skill |
| Naming, helpers, file boundaries, PHP style | [`rules/style.md`](rules/style.md) |
| Actions, services, dependencies, application structure | [`rules/architecture.md`](rules/architecture.md) |

## Decision Rules

- Prefer framework features and existing application abstractions over new helpers or dependencies.
- Avoid speculative abstractions. Extract code when it creates a clear domain boundary, removes meaningful duplication, or makes behavior independently testable.
- Keep database access out of Blade views and prevent hidden N+1 queries across controllers, resources, jobs, and serialization.
Pliki w paczce (20)
  • SKILL.md 5 KB
  • rules/advanced-queries.md 4 KB
  • rules/architecture.md 6 KB
  • rules/blade-views.md 2 KB
  • rules/caching.md 3 KB
  • rules/collections.md 2 KB
  • rules/config.md 2 KB
  • rules/db-performance.md 5 KB
  • rules/eloquent.md 4 KB
  • rules/error-handling.md 3 KB
  • rules/events-notifications.md 3 KB
  • rules/http-client.md 4 KB
  • rules/mail.md 2 KB
  • rules/migrations.md 3 KB
  • rules/queue-jobs.md 4 KB
  • rules/routing.md 4 KB
  • rules/scheduling.md 3 KB
  • rules/security.md 6 KB
  • rules/style.md 4 KB
  • rules/validation.md 3 KB

Wersje

RepozytoriumWynikLicencja
Ta strona · coollabsio/coolify90Apache-2.0
AsyrafHussin/agent-skills100MIT
laravel/boost90MIT

Identyczna treść występuje jeszcze w 2 innych folderach na GitHubie. Tu pokazujemy jedną, najlepiej ocenioną kopię.

Migawka bazy z 28.10.2026 · wersja paczki d0c7b579b589 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 90php-laravel
    Buduje aplikacje Laravel z cienkimi kontrolerami, warstwą serwisów, walidacją żądań i zadaniami w kolejkach w wersjach 10 i nowszych.
  • 90php-laravel
    Buduje i aktualizuje aplikacje Laravel z walidacją żądań, politykami autoryzacji i niezawodnymi zadaniami w kolejkach.
  • 100spatie-laravel-php
    Stosuje standardy kodowania Spatie dla Laravela i PHP przy kontrolerach, modelach, migracjach, testach i szablonach Blade.
  • 86laravel
    Pomaga w backendzie Laravel: aplikacjach PHP, Eloquent ORM, zadaniach w kolejkach i rozwoju API.
  • 90php-laravel
    Pisze aplikacje w PHP 8.2+ i Laravelu: Eloquent, kolejki, widoki Blade, migracje i testy w Pest.
  • 100laravel-eloquent
    Pomaga pracować z modelami bazy danych w Laravel 13: Eloquent ORM, atrybuty PHP, relacje, zapytania, obserwatory i fabryki.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.