Expert Laravel development guidelines with Filament, Livewire, Pest testing, and Laravel Boost MCP integration. Follows Laravel 12 conventions and best practices.
Expert assistant for Laravel application development following Laravel maintainer-curated guidelines. Supports Laravel 12, Filament v4, Livewire v3, Pest v3, and Laravel Boost MCP tools.
This skill is optimized for Laravel applications using:
Laravel 12 uses a streamlined file structure:
Always use explicit type declarations:
```php
protected function isAccessible(User $user, ?string $path = null): bool
{
// Implementation
}
```
Use PHP 8+ constructor property promotion:
```php
public function __construct(public GitHub $github) { }
```
Always use curly braces, even for single-line statements.
Use TitleCase for enum keys: `FavoritePerson`, `BestLake`, `Monthly`
Always use proper Eloquent relationship methods with return type hints.
When modifying columns, include ALL previously defined attributes or they will be dropped:
```php
$table->string('email')->nullable()->change(); // Must specify nullable again
```
Limit eagerly loaded records natively:
```php
$query->latest()->limit(10);
```
Define casts in a `casts()` method (follow existing convention):
```php
protected function casts(): array
{
return ['created_at' => 'datetime'];
}
```
Always create Form Request classes for validation instead of inline validation:
```bash
php artisan make:request StorePostRequest
```
Include both validation rules and custom error messages. Check sibling Form Requests for array vs. string-based rule conventions.
Use Eloquent API Resources and versioning unless existing routes follow a different convention.
```bash
php artisan make:livewire Posts\\CreatePost
```
Add loading states:
```blade
<button wire:click="save" wire:loading.attr="disabled">
Save
</button>
```
Always use `wire:key` in loops:
```blade
@foreach ($items as $item)
<div wire:key="item-{{ $item->id }}">
{{ $item->name }}
</div>
@endforeach
```
```php
public function mount(User $user)
{
$this->user = $user;
}
public function updatedSearch()
{
$this->resetPage();
}
```
Use `$this->dispatch()` for events (not `emit` or `dispatchBrowserEvent`):
```php
$this->dispatch('post-created', postId: $post->id);
```
Alpine is included with Livewire v3 - don't manually include it. Available plugins: persist, intersect, collapse, focus.
```bash
php artisan make:test --pest ExampleTest # Feature test
php artisan make:test --pest --unit UserTest # Unit test
```
Most tests should be feature tests. Test happy paths, failure paths, and edge cases:
```php
it('creates a post successfully', function () {
$user = User::factory()->create();
$response = $this->actingAs($user)->postJson('/api/posts', [
'title' => 'Test Post',
'content' => 'Test content'
]);
$response->assertSuccessful();
expect(Post::count())->toBe(1);
});
```
```php
Livewire::test(Counter::class)
->assertSet('count', 0)
->call('increment')
->assertSet('count', 1)
->assertSee(1);
// Test component exists on page
$this->get('/posts/create')
->assertSeeLivewire(CreatePost::class);
```
```bash
php artisan test # All tests
php artisan test tests/Feature/ExampleTest.php # Specific file
php artisan test --filter=testName # Filtered
```
Run minimal tests with appropriate filters before finalizing changes.
Use specific assertion methods:
```php
$response->assertSuccessful(); // Not assertStatus(200)
$response->assertForbidden(); // Not assertStatus(403)
$response->assertNotFound(); // Not assertStatus(404)
```
Use model factories in tests. Check for custom states before manual setup:
```php
$user = User::factory()->admin()->create();
```
Always use `config()` helper outside of config files:
```php
// Good
config('app.name')
// Bad
env('APP_NAME')
```
Prefer named routes:
```php
route('posts.show', $post) // Not url("/posts/{$post->id}")
```
Use queued jobs for time-consuming operations:
```php
class ProcessPodcast implements ShouldQueue
{
use Queueable;
// ...
}
```
Always run Pint before finalizing changes:
```bash
vendor/bin/pint --dirty # Format changed files
vendor/bin/pint # Format all files
```
Don't use `--test` flag - just run Pint to fix issues.
Laravel Boost provides powerful MCP tools specific to your application:
Use `search-docs` tool before other approaches. It returns version-specific documentation:
```
search-docs(['rate limiting', 'routing rate limiting', 'routing'])
search-docs(['test resource table']) # Good
search-docs(['filament 4 test resource table']) # Bad
```
Use Laravel's built-in features:
If frontend changes aren't reflected:
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/laravel-boost-development-assistant/raw