Laravel Boost Development
Expert guidance for building Laravel applications following Laravel Boost guidelines, curated by Laravel maintainers.
Core Technology Stack
This skill provides expertise for Laravel applications using:
PHP 8.4.12Laravel Framework v12Filament v4 (Server-Driven UI)Livewire v3Pest v4 (Testing)Tailwind CSS v4Laravel Horizon, Reverb, SanctumLaravel Pint (Code Formatting)Laravel Sail (Development)Step-by-Step Instructions
1. Follow Existing Conventions
**BEFORE creating or editing any file:**
Check sibling files for structure, approach, and naming patternsUse descriptive names (e.g., `isRegisteredForDiscounts`, not `discount()`)Check for existing components to reuseMaintain existing directory structureNever change dependencies without approval2. Activate Domain-Specific Skills
**Activate the appropriate skill when working in these domains:**
**Testing** → Use `pest-testing` skill when writing tests, creating unit/feature tests, adding assertions, testing Livewire components, or debugging test failures**Styling** → Use `tailwindcss-development` skill when adding styles, working with UI components, responsive design, or any visual changes3. Search Documentation First
**CRITICAL: Use `search-docs` tool before making code changes**
Pass multiple broad, simple queries: `['rate limiting', 'routing rate limiting', 'routing']`Do NOT include package names in queries (they're auto-detected)Use version-specific docs for Laravel, Filament, Pest, and Tailwind**Search syntax:**
Simple words: `authentication` (auto-stems to 'authenticate', 'auth')Multiple words: `rate limit` (AND logic)Exact phrases: `"infinite scroll"` (adjacent words)Mixed: `middleware "rate limit"`Multiple queries: `["authentication", "middleware"]`4. Use Artisan Commands
**Always use `php artisan make:` commands to create files:**
Use `list-artisan-commands` tool to check available commands and parametersPass `--no-interaction` to all Artisan commandsPass correct `--options` for proper behaviorFor generic PHP classes: `php artisan make:class`**Examples:**
```bash
php artisan make:model --no-interaction User -mfs
php artisan make:test --pest --no-interaction UserTest
php artisan make:class --no-interaction Services/PaymentProcessor
```
5. Follow PHP Best Practices
**Constructor property promotion:**
```php
public function __construct(public GitHub $github) { }
```
**Explicit return types:**
```php
protected function isAccessible(User $user, ?string $path = null): bool
{
// ...
}
```
**Always use curly braces** for control structures, even single-line bodies.
**Enum keys:** Use TitleCase (`FavoritePerson`, `BestLake`, `Monthly`)
6. Database & Eloquent
**Prefer Eloquent over raw queries:**
Use `Model::query()` instead of `DB::`Always use proper relationship methods with return type hintsUse eager loading to prevent N+1 queriesWhen creating models, create factories and seeders too**Model casts** should use `casts()` method (Laravel 12):
```php
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
];
}
```
**Migration modifications** must include ALL previous attributes or they'll be dropped.
7. Controllers & Validation
**Always create Form Request classes:**
Never use inline validation in controllersInclude both rules and custom error messagesCheck sibling Form Requests for array vs string-based rules8. Laravel 12 Specific
**Middleware configuration:**
Configured in `bootstrap/app.php` using `Application::configure()->withMiddleware()`NOT in `app/Http/Kernel.php` (doesn't exist in Laravel 12)**Console commands:**
Auto-discovered from `app/Console/Commands/`No manual registration neededConfigure in `bootstrap/app.php` or `routes/console.php`**Service providers:**
Register in `bootstrap/providers.php`9. Filament (Server-Driven UI)
**Use static `make()` methods:**
```php
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Utilities\Get;
Select::make('type')
->options(CompanyType::class)
->required()
->live(),
TextInput::make('company_name')
->required()
->visible(fn (Get $get): bool => $get('type') === 'business'),
```
**Computed columns:**
```php
TextColumn::make('full_name')
->state(fn (User $record): string => "{$record->first_name} {$record->last_name}"),
```
**Use Filament Artisan commands** - find with `list-artisan-commands`
10. Testing with Pest
**EVERY change must be programmatically tested:**
Write new test or update existing testRun affected tests to verify they passUse minimum tests needed: `php artisan test --compact --filter=testName`**Create tests:**
```bash
php artisan make:test --pest --no-interaction UserTest
php artisan make:test --pest --unit --no-interaction CalculatorTest
```
**Use factories:**
Always use model factories in testsCheck for custom factory states before manual setupUse `$this->faker` or `fake()` (follow project convention)**Filament testing:**
```php
livewire(ListUsers::class)
->assertCanSeeTableRecords($users)
->searchTable($users->first()->name)
->assertCanSeeTableRecords($users->take(1));
```
11. Code Formatting
**Run Pint before finalizing:**
```bash
vendor/bin/pint --dirty
```
Never run `--test`, just run `vendor/bin/pint` to fix formatting.
12. Configuration & Environment
Use environment variables ONLY in config filesNever use `env()` outside config filesAlways use `config('app.name')`, not `env('APP_NAME')`13. Best Practices
**Authentication & Authorization:**
Use built-in Laravel features (gates, policies, Sanctum)**URL Generation:**
Prefer named routes and `route()` function**Queues:**
Use queued jobs with `ShouldQueue` interface for time-consuming operations**APIs:**
Default to Eloquent API Resources and API versioningFollow existing convention if project differs**Comments:**
Prefer PHPDoc blocks over inline commentsAdd array shape type definitions when appropriate14. Debugging Tools
**Use Laravel Boost MCP tools:**
`tinker` - Execute PHP to debug or query Eloquent models`database-query` - Read from database`browser-logs` - Read browser logs, errors, exceptions (only recent logs are useful)`get-absolute-url` - Generate valid URLs for the Laravel Herd environment15. Laravel Herd
Application served at `https?://[kebab-case-project-dir].test`Use `get-absolute-url` tool to generate valid URLsDo NOT run commands to make site available - it's always available through Herd16. Frontend
**If frontend changes aren't reflected:**
User may need to run `npm run build`, `npm run dev`, or `composer run dev`Ask the user to run the appropriate command**Vite errors:**
Run `npm run build` or ask user to run `npm run dev` or `composer run dev`Important Constraints
Do NOT create documentation files unless explicitly requestedDo NOT create verification scripts when tests existDo NOT delete tests without approvalBe concise in explanations - focus on what's importantExamples
**Creating a model with factory and migration:**
```bash
php artisan make:model --no-interaction Product -mfs
```
**Form Request validation:**
```php
class StoreUserRequest extends FormRequest
{
public function rules(): array
{
return [
'email' => ['required', 'email', 'unique:users'],
'name' => ['required', 'string', 'max:255'],
];
}
}
```
**Eager loading to prevent N+1:**
```php
$users = User::query()
->with(['posts' => fn ($query) => $query->latest()->limit(10)])
->get();
```