Comprehensive GitHub Copilot instructions for Laravel development with Boost MCP server, Livewire, Tailwind CSS v4, and testing best practices.
Comprehensive GitHub Copilot instructions for Laravel development using the Laravel Boost MCP server, with best practices for Laravel 12, Livewire 3, Tailwind CSS v4, and testing.
This skill configures GitHub Copilot to:
1. **Use Boost Tools Proactively**
- `list-artisan-commands` - Check available Artisan command parameters
- `get-absolute-url` - Generate correct project URLs with scheme/domain/port
- `tinker` - Execute PHP code for debugging or Eloquent queries
- `database-query` - Read from database directly
- `browser-logs` - Read recent browser logs, errors, and exceptions
- `search-docs` - Search version-specific Laravel ecosystem documentation
2. **Documentation Search Strategy**
- ALWAYS use `search-docs` before making code changes
- Pass multiple broad, simple queries: `['rate limiting', 'routing rate limiting', 'routing']`
- Tool automatically filters by installed package versions
- Supports Laravel, Inertia, Livewire, Filament, Tailwind, Pest, Nova, etc.
1. **File Creation**
- Use `php artisan make:*` commands with `--no-interaction` flag
- For generic PHP classes: `artisan make:class`
- When creating models, also generate factories and seeders
2. **Database & Eloquent**
- Use proper Eloquent relationships with return type hints
- Prefer `Model::query()` over `DB::`
- Always eager load to prevent N+1 queries
- Use query builder only for very complex operations
- When modifying columns in migrations, include ALL previous attributes
3. **Controllers & Validation**
- Create Form Request classes for validation (never inline)
- Include both rules and custom error messages
- Check sibling Form Requests for array vs string validation conventions
4. **APIs**
- Default to Eloquent API Resources with versioning
- Follow existing application API conventions
5. **Configuration**
- NEVER use `env()` outside config files
- Always use `config('app.name')` not `env('APP_NAME')`
6. **URL Generation**
- Prefer named routes with `route()` function
7. **Jobs & Queues**
- Use `ShouldQueue` interface for time-consuming operations
8. **Testing**
- Use model factories with custom states
- Follow existing `$this->faker` vs `fake()` conventions
- Use `php artisan make:test` for feature tests, `--unit` for unit tests
- Most tests should be feature tests
1. **Legacy Structure (Laravel 10)**
- This project uses Laravel 10 structure (NOT new streamlined structure)
- Middleware in `app/Http/Middleware/`
- Providers in `app/Providers/`
- Middleware registration in `app/Http/Kernel.php`
- Exception handling in `app/Exceptions/Handler.php`
- Console commands in `app/Console/Kernel.php`
- NO `bootstrap/app.php` configuration
2. **New Features**
- Use native eager loading limits: `$query->latest()->limit(10)`
- Define casts in `casts()` method (follow existing model conventions)
1. **Component Creation**
- Use `php artisan make:livewire [Posts\\CreatePost]`
- State lives on server, UI reflects it
- All requests hit Laravel backend - validate and authorize
2. **Key Conventions**
- Namespace: `App\Livewire` (not `App\Http\Livewire`)
- Single root element required
- Use `wire:model.live` for real-time, `wire:model` is deferred by default
- Use `$this->dispatch()` not `emit` or `dispatchBrowserEvent`
- Default layout: `components.layouts.app`
3. **Loading States**
- Use `wire:loading` and `wire:dirty`
- Add `wire:key` in loops: `wire:key="item-{{ $item->id }}"`
4. **Lifecycle Hooks**
```php
public function mount(User $user) { $this->user = $user; }
public function updatedSearch() { $this->resetPage(); }
```
5. **Alpine Integration**
- Alpine included with Livewire (don't manually include)
- Available plugins: persist, intersect, collapse, focus
- Hook into `livewire:init` for initialization
6. **Testing**
```php
Livewire::test(Counter::class)
->assertSet('count', 0)
->call('increment')
->assertSet('count', 1)
->assertSee(1);
```
1. **Core Principles**
- Use existing project conventions first
- Use `gap` utilities for spacing, not margins
- Extract repeated patterns into components
- Support dark mode with `dark:` if other pages do
2. **v4 Import Syntax**
```css
@import "tailwindcss";
/* NOT @tailwind directives */
```
3. **Replaced Utilities** (use replacement, not deprecated)
- `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`
4. **Notes**
- `corePlugins` not supported in v4
- Opacity values still numeric
1. **Laravel Pint**
- ALWAYS run `vendor/bin/pint --dirty` before finalizing changes
- Do NOT use `--test` flag, just run `vendor/bin/pint` to fix
1. **Mandatory Testing**
- Every change MUST have a programmatic test
- Write new test or update existing test
- Run minimum tests needed: `php artisan test --filter=TestName`
- Verify tests pass before finalizing
```bash
php artisan make:livewire Posts\\CreatePost --test
vendor/bin/pint --dirty
php artisan test --filter=CreatePostTest
```
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/laravel-boost-copilot-instructions/raw