Laravel Boost Development Guidelines
Expert Laravel development assistant specifically curated for Laravel 12 applications with Filament, Livewire, Pest, and the broader Laravel ecosystem.
Core Technology Stack
This skill provides expert guidance for applications using:
PHP 8.5.2Laravel 12Filament 5Livewire 4Pest 4Larastan 3Laravel Pint 1Tailwind CSS 4Prettier 3Step-by-Step Instructions
1. Understand Application Context
Before making any changes:
Check sibling files for existing conventions (structure, naming, approach)Search for existing components to reuse before creating new onesVerify the directory structure and avoid creating new base folders without approvalReview existing tests to understand coverage2. Use Laravel Boost MCP Tools
When available, leverage Laravel Boost MCP server tools:
Use `list-artisan-commands` before running Artisan commands to verify parametersUse `get-absolute-url` when sharing project URLs with correct scheme/domain/portUse `tinker` for debugging PHP code or querying Eloquent modelsUse `database-query` for read-only database queriesUse `browser-logs` to read recent browser errors and exceptions**CRITICAL**: Use `search-docs` tool FIRST for all Laravel ecosystem documentation needs (Laravel, Filament, Livewire, Pest, Inertia, etc.)3. Search Documentation Properly
**Always search documentation before making code changes:**
Use multiple broad, topic-based queries: `['rate limiting', 'routing rate limiting', 'routing']`Do NOT include package names in queries (already provided): use `test resource table`, not `filament 4 test resource table`Available syntax: - Simple words: `authentication` (auto-stems to 'authenticate', 'auth')
- Multiple words (AND): `rate limit` (both terms required)
- Exact phrases: `"infinite scroll"` (adjacent words, exact order)
- Mixed: `middleware "rate limit"` (AND logic with exact phrase)
- Multiple queries: `["authentication", "middleware"]` (ANY match)
4. Follow Laravel Best Practices
**File Creation:**
Use `php artisan make:` commands with `--no-interaction` flagFor generic classes: `php artisan make:class`For models: include factories and seeders (`php artisan make:model`)For Livewire: `php artisan make:livewire [Posts\CreatePost]`For tests: `php artisan make:test {name}` (feature) or `--unit` flag (unit)**Database & Eloquent:**
Use Eloquent relationships with return type hintsPrefer `Model::query()` over `DB::`Use eager loading to prevent N+1 queriesFor APIs: use Eloquent API Resources with versioningWhen creating models: generate factories and seeders**Validation:**
Always create Form Request classes (not inline validation)Include both rules and custom error messagesCheck sibling requests for array vs string validation convention**Configuration:**
Use environment variables ONLY in config filesUse `config('app.name')`, NEVER `env('APP_NAME')` in code**URL Generation:**
Prefer named routes with `route()` function5. Write Modern PHP Code
**Type Declarations:**
```php
// Use constructor property promotion
public function __construct(public GitHub $github) { }
// Explicit return types
protected function isAccessible(User $user, ?string $path = null): bool
{
// ...
}
```
**Control Structures:**
Always use curly braces, even for single-line statements**Enums:**
Use TitleCase keys: `FavoritePerson`, `BestLake`, `Monthly`**Comments:**
Prefer PHPDoc blocks over inline commentsAdd array shape definitions when appropriate6. Laravel 12 Specific Conventions
**Structure:**
Middleware configured in `bootstrap/app.php` using `Application::configure()->withMiddleware()`Exception and routing configuration in `bootstrap/app.php`Service providers in `bootstrap/providers.php`Console configuration in `bootstrap/app.php` or `routes/console.php`Console commands in `app/Console/Commands/` auto-register**Database:**
When modifying columns, include ALL previous attributes or they'll be droppedUse native eager loading limits: `$query->latest()->limit(10)`**Models:**
Prefer `casts()` method over `$casts` property (check existing models)7. Write Livewire Components Correctly
**Component Structure:**
Single root element requiredState lives on server; UI reflects itAll requests hit Laravel backend—validate and authorize everything**Best Practices:**
```blade
{{-- Use wire:loading and wire:dirty for loading states --}}
{{-- Always add wire:key in loops --}}
@foreach ($items as $item)
<div wire:key="item-{{ $item->id }}">
{{ $item->name }}
</div>
@endforeach
```
**Lifecycle Hooks:**
```php
public function mount(User $user) { $this->user = $user; }
public function updatedSearch() { $this->resetPage(); }
```
8. Write Comprehensive Pest Tests
**Test Structure:**
```php
it('is true', function () {
expect(true)->toBeTrue();
});
```
**Running Tests:**
Minimal filter: `php artisan test --compact --filter=testName`Single file: `php artisan test --compact tests/Feature/ExampleTest.php`All tests: `php artisan test --compact`**Assertions:**
```php
// Use specific methods
$response->assertSuccessful();
$response->assertForbidden();
$response->assertNotFound();
// NOT assertStatus(403)
```
**Testing Livewire:**
```php
Livewire::test(Counter::class)
->assertSet('count', 0)
->call('increment')
->assertSet('count', 1)
->assertSee(1);
$this->get('/posts/create')
->assertSeeLivewire(CreatePost::class);
```
**Datasets:**
```php
it('has emails', function (string $email) {
expect($email)->not->toBeEmpty();
})->with([
'james' => '[email protected]',
'taylor' => '[email protected]',
]);
```
**Coverage:**
Test happy paths, failure paths, and edge casesUse factories for model creation in testsUse `RefreshDatabase` trait when neededNever remove tests without approval9. Pest 4 Browser Testing
**Browser Tests:**
Live in `tests/Browser/`Can use Laravel features: `Event::fake()`, `assertAuthenticated()`, factories, `RefreshDatabase`Interact with page: click, type, scroll, select, submit, drag-and-drop, touch gestures10. Code Formatting
**Before finalizing any changes:**
```bash
vendor/bin/pint --dirty
```
Do NOT run `--test`, just run Pint to fix formatting issues.
11. Handle Frontend Changes
If user doesn't see frontend changes reflected:
They may need to run `npm run build`, `npm run dev`, or `composer run dev`Ask them to run the appropriate command12. Verification Approach
Do NOT create verification scripts when tests existUnit and feature tests prove functionalityWrite or update tests to verify features workImportant Constraints
Follow existing code conventions strictlyDo not create documentation files unless explicitly requestedDo not change dependencies without approvalBe concise—focus on important details, not obvious onesUse descriptive names: `isRegisteredForDiscounts`, not `discount()`Prefer editing existing files over creating new onesNever use `env()` outside config filesExamples
**Good Variable Naming:**
```php
// Good
$isRegisteredForDiscounts
// Bad
$discount()
```
**Good Testing Practice:**
```php
// Run minimal tests with filter
php artisan test --compact --filter=userCanCreatePost
// Then ask: "Would you like to run the full test suite?"
```
**Good Documentation Search:**
```php
// Good queries
['pagination', 'cursor pagination', 'database pagination']
// Bad queries
['laravel 12 pagination', 'eloquent pagination docs']
```