Laravel Boost Development
Comprehensive Laravel development workflow leveraging Laravel Boost MCP server tools for enhanced productivity with Artisan commands, documentation search, Tinker debugging, Livewire components, and Tailwind CSS v4 styling.
Overview
This skill provides expert guidance for Laravel 12 applications using the Laravel Boost MCP server toolkit. It enforces Laravel best practices, proper Eloquent usage, Livewire 3 patterns, Tailwind CSS v4 utilities, and comprehensive testing requirements.
Step-by-Step Instructions
1. Leverage Laravel Boost Tools
**Before any Laravel development task:**
Use `list-artisan-commands` tool when you need to verify available Artisan command parametersUse `get-absolute-url` tool when sharing project URLs with users to ensure correct scheme/domain/portUse `tinker` tool for executing PHP code to debug or query Eloquent models directlyUse `database-query` tool when you only need to read from the databaseUse `browser-logs` tool to read recent browser logs, errors, and exceptions (ignore old logs)**Always use `search-docs` tool first** before other approaches - it returns version-specific documentation for the user's installed packages (Laravel, Inertia, Livewire, Filament, Tailwind, Pest, Nova, etc.)**Documentation search strategy:**
Use multiple, broad, simple topic-based queries: `['rate limiting', 'routing rate limiting', 'routing']`Pass multiple queries at once for best resultsFilter by specific packages if you know which docs you needSearch syntax: simple words (auto-stemming), multiple words (AND logic), quoted phrases (exact), mixed queriesExample: `queries=["authentication", "middleware"]`2. Follow Laravel Best Practices
**File creation:**
Use `php artisan make:` commands with `--no-interaction` flag for all new files (migrations, controllers, models, etc.)For generic PHP classes: `php artisan make:class`When creating models, also create factories and seeders: `php artisan make:model Post -mfs`**Database & Eloquent:**
Always use proper Eloquent relationship methods with return type hintsPrefer `Model::query()` over `DB::` raw queriesUse eager loading to prevent N+1 query problemsOnly use query builder for very complex operationsWhen modifying columns in migrations, include ALL previously defined attributes to prevent data loss**Controllers & Validation:**
Create Form Request classes for validation (never inline validation)Include both validation rules and custom error messagesCheck sibling Form Requests to match existing conventions (array vs. string based rules)**APIs:**
Default to Eloquent API Resources with versioning unless existing routes use different conventions**Configuration:**
Never use `env()` directly outside config filesAlways use `config('app.name')` instead of `env('APP_NAME')`**URL Generation:**
Prefer named routes and `route()` function for internal links**Queues:**
Use queued jobs with `ShouldQueue` interface for time-consuming operations**Authentication & Authorization:**
Use Laravel's built-in features (gates, policies, Sanctum)3. Laravel 12 Structure Considerations
**This skill supports Laravel 12 projects upgraded from Laravel 10:**
Middleware lives in `app/Http/Middleware/`Service providers in `app/Providers/`No `bootstrap/app.php` configurationMiddleware registration in `app/Http/Kernel.php`Exception handling in `app/Exceptions/Handler.php`Console commands in `app/Console/Kernel.php`Rate limits in `RouteServiceProvider` or `app/Http/Kernel.php`**Laravel 12 features:**
Limit eagerly loaded records natively: `$query->latest()->limit(10);`Use `casts()` method on models instead of `$casts` property (follow existing conventions)4. Livewire 3 Development
**Component creation:**
Use `php artisan make:livewire [Posts\\CreatePost]`Components require a single root elementUse `App\Livewire` namespace (not `App\Http\Livewire`)**Data binding:**
Use `wire:model.live` for real-time updates`wire:model` is now deferred by default**Best practices:**
State lives on the server with UI reflecting itAll Livewire requests hit Laravel backend - always validate and authorizeAdd `wire:key` in loops: `<div wire:key="item-{{ $item->id }}">`Use `wire:loading` and `wire:dirty` for loading statesPrefer lifecycle hooks: `mount()`, `updatedFoo()`**Events:**
Use `$this->dispatch()` to dispatch events (not `emit` or `dispatchBrowserEvent`)**Layout:**
Default layout path: `components.layouts.app` (not `layouts.app`)**Alpine.js:**
Alpine is included with Livewire - don't manually include itIncluded plugins: persist, intersect, collapse, focus**Lifecycle hooks:**
Listen for `livewire:init` for initializationHandle session expiration with `fail.status === 419`5. Tailwind CSS v4 Styling
**Import method (v4 change):**
```css
@import "tailwindcss";
```
Do NOT use deprecated `@tailwind` directives from v3.
**Utility classes:**
Use Tailwind CSS classes to match existing project conventionsExtract repeated patterns into components (Blade/JSX/Vue)For spacing in lists, use `gap` utilities instead of margins: `<div class="flex gap-8">`Remove redundant classes, group elements logically**Dark mode:**
If existing components support dark mode, new ones must too using `dark:` prefix**Replaced utilities (do not use deprecated options):**
| Deprecated | Replacement |
|------------|-------------|
| bg-opacity-* | bg-black/* |
| text-opacity-* | text-black/* |
| border-opacity-* | border-black/* |
| flex-shrink-* | shrink-* |
| flex-grow-* | grow-* |
| overflow-ellipsis | text-ellipsis |
| decoration-slice | box-decoration-slice |
**Note:** Opacity values are still numeric. `corePlugins` is not supported in v4.
6. Testing Requirements
**Critical: Every change MUST be programmatically tested.**
**Test creation:**
Use `php artisan make:test [options] <name>` for feature testsPass `--unit` flag for unit testsMost tests should be feature tests**Test patterns:**
Use model factories for test dataCheck for custom factory states before manual setupUse `$this->faker->word()` or `fake()->randomDigit()` (follow existing conventions)**Livewire testing:**
```php
Livewire::test(Counter::class)
->assertSet('count', 0)
->call('increment')
->assertSet('count', 1)
->assertSee(1)
->assertStatus(200);
```
**Running tests:**
Run minimum tests needed for speed: `php artisan test --filter=TestName`Ensure tests pass before finalizing changes7. Code Formatting
**Before finalizing any changes:**
Run `vendor/bin/pint --dirty` to match project's code styleDo NOT run `vendor/bin/pint --test`, just run `vendor/bin/pint` to fix issues8. Error Handling
**Common errors:**
"Vite manifest" error: Run `npm run build` or ask user to run `npm run dev` or `composer run dev`Constraints
All Artisan commands must include `--no-interaction` flagNever use `env()` outside config filesNever bypass Eloquent ORM unless absolutely necessaryEvery code change requires a passing testAlways search documentation before implementing solutionsFollow existing application conventions for consistencyExample Usage
**Creating a new model with relationships:**
1. Search docs: `search-docs` with queries `["eloquent relationships", "model factories"]`
2. Create model: `php artisan make:model Post -mfs --no-interaction`
3. Define relationships with type hints in model
4. Create Form Request for validation
5. Write feature test using factory
6. Run `vendor/bin/pint --dirty`
7. Run tests: `php artisan test --filter=PostTest`
**Building a Livewire component:**
1. Search docs: `search-docs` with queries `["livewire forms", "livewire validation"]`
2. Create component: `php artisan make:livewire Posts\\CreatePost --no-interaction`
3. Add single root element, use `wire:model.live` for real-time binding
4. Add `wire:loading` states
5. Validate in component action method
6. Style with Tailwind v4 utilities (use `gap` for spacing)
7. Write Livewire test with `Livewire::test()`
8. Run `vendor/bin/pint --dirty`
9. Run test to verify
**Debugging with Boost tools:**
1. Check browser logs: Use `browser-logs` tool for recent errors
2. Query database: Use `database-query` tool for read-only queries
3. Execute PHP: Use `tinker` tool for debugging or Eloquent queries
4. Verify URLs: Use `get-absolute-url` tool before sharing links