Home › Laravel › Laravel Copilot instructions

Laravel Copilot instructions

GitHub Copilot instructions for Laravel 11+ apps with Eloquent, Pest, and Form Requests.

GitHub CopilotLaravel

How to use

Save this as .github/copilot-instructions.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

.github/copilot-instructions.mdDownload  
# Copilot instructions — Laravel

Laravel 11+, PHP 8.3, MySQL/PostgreSQL, Pest for tests, Laravel Pint for style.

- Validation lives in Form Request classes (`php artisan make:request`), never inline in controllers.
- Controllers are thin and resourceful; use single-action invokable controllers for one-off endpoints.
- Business logic goes in Action classes (`app/Actions`) with a single `handle()` method.
- Eloquent: define relationships and casts; eager load with `with()` to avoid N+1. Enable `Model::preventLazyLoading()` outside production.
- Use API Resources for JSON responses. Use policies for authorization (`$this->authorize`/`can` middleware).
- Queue anything slow (mail, external APIs) with jobs implementing `ShouldQueue`.
- Config via `config()` only; `env()` is allowed only inside config files.
- Tests: Pest feature tests with `RefreshDatabase` and model factories. Run `./vendor/bin/pint && php artisan test`.

Related rules

Angular 20 Copilot instructions

Copilot instructions for Angular 20 apps using standalone components, signals, and the new control flow.

GitHub CopilotAngular

Code review Copilot instructions

Copilot instructions focused on pull request review: what to flag, severity labels, and how to word comments.

GitHub CopilotAgent workflows

C# / .NET Copilot path instructions

Path-specific Copilot instructions for C# files on .NET 10: nullable types, async, records, and logging.

GitHub Copilot.NET / ASP.NET Core

Dockerfile Copilot path instructions

Path-specific Copilot instructions for Dockerfiles and compose files: multi-stage builds, non-root, and pinned images.

GitHub CopilotDocker

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.