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

Ruby on Rails Copilot instructions

GitHub Copilot custom instructions for Rails 8 apps with Hotwire, RSpec and Rubocop.

GitHub CopilotRuby on Rails

TypeScript Node.js API Copilot instructions

Copilot instructions for Node.js + TypeScript APIs with Hono/Express, zod and Vitest.

GitHub CopilotNode.js / TypeScript

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.